import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int q = scanner.nextInt(); for (int a = 0; a < q; a++) { int n = scanner.nextInt(); List xList = new ArrayList(); List yList = new ArrayList(); for (int i = 0; i < n; i++) { xList.add(scanner.nextInt()); yList.add(scanner.nextInt()); } int xMax = Collections.max(xList); int yMax = Collections.max(yList); int xMin = Collections.min(xList); int yMin = Collections.min(yList); String doesFall = "YES"; for (int i = 0; i < n; i++) { if ((xList.get(i) < xMax && yList.get(i) < yMax) && (xList.get(i) > xMin && yList.get(i) > yMin)) { doesFall = "NO"; break; } } System.out.println(doesFall); } scanner.close(); } }