N=int(input()) SET=set() for i in range(N): a,b,c,d=map(int,input().split()) SET.add((a,b)) SET.add((c,d)) if len(SET)+1<=N: print("NO") else: print("YES")