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()); Stack originPoint = new Stack(); Stack originPointY = new Stack(); 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]); originPoint.Push(x); originPointY.Push(y); } int counter = 0; foreach(int i in originPoint) { if(i == originPoint.Peek()) { counter++; } } int counter1 = 0; foreach(int i in originPointY) { if(i == originPointY.Peek()) { counter1++; } } if(counter == n || counter1 == n) { Console.WriteLine("YES"); }else{ Console.WriteLine("NO"); } } }