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); long q = in.nextLong(); for(int iii = 0; iii < q; iii++){ int n = in.nextInt(); int x[] = new int[n]; int y[] = new int[n]; int xm = Integer.MAX_VALUE; int xx = Integer.MIN_VALUE; int ym = Integer.MAX_VALUE; int yx = Integer.MIN_VALUE; for(int i = 0; i < n; i++){ x[i] = in.nextInt(); y[i] = in.nextInt(); xm = Math.min(xm, x[i]); xx = Math.max(xx, x[i]); ym = Math.min(ym, y[i]); yx = Math.max(yx, y[i]); } boolean possible = true; for(int i = 0; i < n; i++){ if(x[i] != xm && x[i] != xx && y[i] != ym && y[i] != yx){ possible = false; break; } } System.out.println(possible?"YES":"NO"); } } }