import java.io.*; import java.util.*; public class Solution { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { int q = in.nextInt(); for (int query = 0; query < q; query++) { solve(in.nextInt()); } in.close(); } private static void solve(int n) { int[][] vectors = new int[n][2]; int maxX = 0, maxY = 0; int minX = 0, minY = 0; for (int i = 0; i < n; i++) { vectors[i][0] = in.nextInt(); vectors[i][1] = in.nextInt(); if (i == 0) { minX = vectors[i][0]; maxX = vectors[i][0]; minY = vectors[i][1]; maxY = vectors[i][1]; } if (vectors[i][0] > maxX) { maxX = vectors[i][0]; } else if (vectors[i][0] < minX) { minX = vectors[i][0]; } if (vectors[i][1] > maxY) { maxY = vectors[i][1]; } else if (vectors[i][1] < minY) { minY = vectors[i][1]; } } for (int i = 0; i < n; i++) { int x = vectors[i][0]; int y = vectors[i][1]; if ((x > minX && x < maxX) && (y > minY && y < maxY)) { System.out.println("NO"); return; } } System.out.println("YES"); } }