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()); var xs = new int[n]; var ys = new int[n]; for(int a0 = 0; a0 < n; a0++){ string[] tokens_x = Console.ReadLine().Split(' '); xs[a0] = Convert.ToInt32(tokens_x[0]); ys[a0] = Convert.ToInt32(tokens_x[1]); } var firstx = xs[0]; var firsty = ys[0]; var output = xs.All(x => x == firstx) || ys.All(y => y == firsty); Console.WriteLine(output? "YES" : "NO"); } }