using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ProblemSolver { class Solution { static char[] splitors = { ' ' }; /* Input data here */ static int n; static int[] x; static int[] y; static void Input() { n = int.Parse(Console.ReadLine()); x = new int[n]; y = new int[n]; for (int i = 0; i < n; i++) { string[] str = Console.ReadLine().Split(splitors); x[i] = int.Parse(str[0]); y[i] = int.Parse(str[1]); } } static void Search() { int minx = int.MaxValue; int miny = int.MaxValue; int maxx = int.MinValue; int maxy = int.MinValue; for (int i = 0; i < n; i++) { minx = Math.Min(minx, x[i]); miny = Math.Min(miny, y[i]); maxx = Math.Max(maxx, x[i]); maxy = Math.Max(maxy, y[i]); } for (int i = 0; i < n; i++) if (x[i] == minx || x[i] == maxx || y[i] == miny || y[i] == maxy) { continue; } else { Console.WriteLine("NO"); return; } Console.WriteLine("YES"); } static void Main(string[] args) { int testcases = int.Parse(Console.ReadLine()); for (int i = 0; i < testcases; i++) { Input(); Search(); } } } }