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[] x = new int[n]; int[] y = new int[n]; for(int a0 = 0; a0 < n; a0++){ string[] tokens_x = Console.ReadLine().Split(' '); x[a0] = Convert.ToInt32(tokens_x[0]); y[a0] = Convert.ToInt32(tokens_x[1]); } var x1 = x[0]; var y1 = y[0]; if(x.All(it => it == x1) || y.All(it => it == y1)) { Console.WriteLine("YES"); }else Console.WriteLine("NO"); } }