#!/bin/python3 xSet = set() ySet = set() coordList = [] n = int(input().strip()) for a in range(n): x, y = input().strip().split(' ') x, y = [int(x), int(y)] coordList.append((x,y)) for i in coordList: xSet.add(i[0]) ySet.add(i[1]) if len(xSet) == 1 or len(ySet) == 1: print("YES") else: print("NO")