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()); bool flagx = true, flagy = true; int? x = null, y = null; for(int a0 = 0; a0 < n; a0++){ string[] tokens = Console.ReadLine().Split(' '); int x1 = Convert.ToInt32(tokens[0]); int y1 = Convert.ToInt32(tokens[1]); if(x==null) x=x1; if(y==null) y=y1; if(flagx && x!=x1) flagx = false; if(flagy && y!=y1) flagy = false; } if(flagx || flagy) Console.WriteLine("YES"); else Console.WriteLine("NO"); } }