using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); int kx=-1; int ky=-1; bool isVert = true; bool isHoriz = true; for(int a0 = 0; a0 < n; a0++){ string[] tokens_x = Console.ReadLine().Split(' '); int x = Convert.ToInt32(tokens_x[0]); int y = Convert.ToInt32(tokens_x[1]); if (a0==0) { kx=x; ky=y; } else { if (x != kx) isVert = false; if (y != ky) isHoriz = false; } } Console.WriteLine((isVert || isHoriz) ? "YES" : "NO"); } }