#!/bin/python3 import sys n = int(input().strip()) x1,y1 = -11,-11 count1 = 0 count2 = 0 for a0 in range(n): x,y = input().strip().split(' ') x,y = [int(x),int(y)] if(x1== -11 and y1 == -11): x1 = x y1 = y count1+=1 count2+=1 else: if(x1==x): count1+=1 if(y1==y): count2+=1 if(count1==n or count2==n): print("YES") else: print("NO")