import java.io.*; import java.util.*; 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 s = new Scanner(System.in); int times = s.nextInt(); ArrayList p = new ArrayList(); for(int i = 0; i < times; i++){ int points = s.nextInt(); for(int j = 0; j < points; j++){ p.add(new Point(s.nextInt(),s.nextInt())); } int l = 0; int b = 0; int ll = 0; int lb = 0; for(Point point:p){ if(point.x > l){ l = point.x; } if(point.x < ll){ ll = point.x; } if(point.y > b){ b = point.y; } if(point.y < lb){ lb = point.y; } } boolean ans = true; for(Point point:p){ if(point.x == l || point.y == b || point.x == ll || point.y == lb){ } else{ ans = false; } } if(ans){ System.out.println("YES"); } else{ System.out.println("NO"); } } } } class Point{ int x; int y; Point(int X, int Y){ x = X; y = Y; } }