n = int(input()) target_list = [[2, 8], [3, 9], [7, 9]] for i in range(n): x1, y1, x2, y2 =[int(i) for i in input().split()] for j in range(3): if x1 == target_list[j][0] and y1 == target_list[j][1]: target_list[j][0] = x2 target_list[j][1] = y2 break if target_list == [[5, 8], [4, 8], [6, 8]]: print('YES') else: print('NO')