N = int(input()) xyxy = [list(map(int, input().split())) for _ in range(N)] d = dict() d[(2, 8)] = 'A' d[(3, 9)] = 'B' d[(7, 9)] = 'C' for x1, y1, x2, y2 in xyxy: if (x1, y1) in d: d[(x2, y2)] = d[(x1, y1)] d[(x1, y1)] = '' if d[(5, 8)]=='A' and d[(4, 8)]=='B' and d[(6, 8)]=='C': print("YES") else: print("NO")