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 in = new Scanner(System.in); int q = in.nextInt(); for (int k = 0; k < q; k++) { int n = in.nextInt(); int[] x = new int[n]; int[] y = new int[n]; for (int i = 0; i < n; i++) { x[i] = in.nextInt(); y[i] = in.nextInt(); } int ixmin = 0; int iymin = 0; int ixmax = 0; int iymax = 0; for (int i = 0; i < n; i++) { if (x[ixmin] > x[i]) ixmin = i; if (y[iymin] > y[i]) iymin = i; if (x[ixmax] < x[i]) ixmax = i; if (y[iymax] < y[i]) iymax = i; } int xmin = x[ixmin]; int ymin = y[iymin]; int xmax = x[ixmax]; int ymax = y[iymax]; boolean flag = true; for (int i = 0; i < n; i++) { if (x[i] != xmin && x[i] != xmax && y[i] != ymin && y[i] != ymax) { flag = false; break; } } if (flag) { System.out.println("YES"); } else { System.out.println("NO"); } } } }