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 [,] a = new int[n,2]; 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]); a[a0, 0] = x; a[a0, 1] = y; } bool v = true; bool h = true; for(int a0 = 0; a0 < n -1; a0++){ if(h && a[a0, 0] == a[a0 + 1, 0]) h = true; else h = false; if(v && a[a0, 1] == a[a0 + 1, 1]) v = true; else v = false; } if (h || v) Console.WriteLine("YES"); else Console.WriteLine("NO"); } }