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[] xPoints = new int[n]; int[] yPoints = new int[n]; 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]); xPoints[a0] = x; yPoints[a0] = y; } bool horizontal = true; bool vertical = true; for (int i = 1; i < n; i++) { for (int j = 0; j < n; j++) { if (xPoints[i] != xPoints[j]) horizontal = false; if (yPoints[i] != yPoints[j]) vertical = false; } } if (horizontal || vertical) Console.WriteLine("YES"); else Console.WriteLine("NO"); } }