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()); bool horizontal = true; bool vertical = true; int h = 0; int v = 0; for(int a0 = 0; a0 < n; a0++){ string[] tokens_x = Console.ReadLine().Split(' '); int x = Convert.ToInt32(tokens_x[0]); if(a0 == 0) h = x; else if(h != x) horizontal = false; int y = Convert.ToInt32(tokens_x[1]); if(a0 == 0) v = y; else if(v != y) vertical = false; } if(horizontal || vertical) Console.WriteLine("YES"); else Console.WriteLine("NO"); } }