import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for(int h = 0; h < q; h++){ int n = sc.nextInt(); int[] x = new int[n]; int[] y = new int[n]; for(int i = 0; i < n; i++){ x[i] = sc.nextInt(); y[i] = sc.nextInt(); } int[] xSort = x; Arrays.sort(xSort); int[] ySort = y; Arrays.sort(ySort); String edges = "YES"; for(int k = 0; k < n; k++){ if(x[k] > xSort[0] && x[k] < xSort[n - 1] && y[k] > ySort[0] && y[k] < ySort[n - 1]){ edges = "NO"; } } System.out.println(edges); } } }