n=int(input()) x,y = map(int,input().split()) a,b=True,True for i in range(n-1): c,d=map(int, input().split()) a = a and c == x b = b and d == y print("YES" if a or b else "NO")