using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { class Points { public int x; public int y; public Points(int x,int y) { this.x = x; this.y = y; } } static void Main(String[] args) { int cases = Convert.ToInt32(Console.ReadLine()); while (cases > 0) { cases--; int n = Convert.ToInt32(Console.ReadLine()); Points[] pts = new Points[n]; List online = new List(); for (int i = 0; i < n; i++) { string[] c_temp = Console.ReadLine().Split(' '); pts[i] = new Points(Int32.Parse(c_temp[0]), Int32.Parse(c_temp[1])); } int xmax = pts.Select(x => x.x).Max(); int ymax = pts.Select(x => x.y).Max(); int xmin = pts.Select(x => x.x).Min(); int ymin = pts.Select(x => x.y).Min(); foreach (var item in pts) { if (item.x == xmin || item.x == xmax || item.y == ymin || item.y == ymax) online.Add(item); } if(pts.Length==online.Count()) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } }