using System; using System.Collections.Generic; using System.IO; class Solution { static void Main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */ int q = Convert.ToInt32(Console.ReadLine()); while (q != 0) { int n = Convert.ToInt32(Console.ReadLine()); int [,] points = new int[n,2]; int xMin = Int32.MaxValue; int xMax = Int32.MinValue; int yMin = Int32.MaxValue; int yMax = Int32.MinValue; for (int i = 0; i < n; i++) { string [] tokens = Console.ReadLine().Split(' '); points[i,0] = Convert.ToInt32(tokens[0]); points[i,1] = Convert.ToInt32(tokens[1]); if (points[i,0] < xMin) xMin = points[i,0]; if (points[i,0] > xMax) xMax = points[i,0]; if (points[i,1] < yMin) yMin = points[i,1]; if (points[i,1] > yMax) yMax = points[i,1]; } bool result = true; for (int i = 0; i < n; i++) { if (points[i,0] != xMin && points[i,0] != xMax && points[i,1] != yMin && points[i,1] != yMax) { result = false; break; } } if (result) Console.WriteLine("YES"); else Console.WriteLine("NO"); q--; } } }