using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { bool horizontal = true; bool vertical = true; int prevX = -1; int prevY = -1; int n = Convert.ToInt32(Console.ReadLine()); 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) { prevX = x; prevY = y; } else { if( prevX != x) vertical = false; if(prevY != y) horizontal = false; } if(!horizontal && !vertical) { Console.WriteLine("NO"); break; } } if(horizontal || vertical) { Console.WriteLine("YES"); } } }