#!/bin/python3 import sys n = int(input().strip()) def f(): x0,y0 = input().strip().split(' ') x0,y0 = [int(x0),int(y0)] xs,ys=True,True for a0 in range(n-1): x,y = input().strip().split(' ') x,y = [int(x),int(y)] if x != x0: xs = False if y != y0: ys = False if not xs and not ys: return "NO" return "YES" print(f())