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) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); while (q-- > 0) { int n = sc.nextInt(); Point[] points = new Point[n]; for (int i = 0; i < n; i++) { Point p = new Point(sc.nextInt(), sc.nextInt()); points[i] = p; } Arrays.sort(points); String r = "NO"; if(points.length == 1 || points.length == 2) { r = "YES"; } else if(points.length == 3) { if(points[0].x == points[1].x && points[1].y == points[2].y) r = "YES"; } else { if(points[0].x == points[1].x && points[1].y == points[2].y && points[2].x == points[3].x && points[1].y == points[2].y) r = "YES"; } System.out.println(r); } } } class Point implements Comparable { int x, y; public Point(int x, int y) { this.x = x; this.y = y; } @Override public String toString() { return "Point [x=" + x + ", y=" + y + "]"; } @Override public int compareTo(Point p) { return x > p.x ? 1 : -1; } }