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 isStraight = true; //all would share an x co-ordinatie if they are vertical bool isVertical = true; bool isHorizontal = true; int currentX = -20; int currentY = -20; 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(currentX < -10) currentX = x; if(currentY < -10) currentY = y; //check vertical isVertical &= currentX == x; //check Horizontal isHorizontal &= currentY == y; } Console.WriteLine(isVertical || isHorizontal ? "YES": "NO"); } }