n = int(input()) abc = [[2, 8], [3, 9], [7, 9]] for i in range(n): x1, y1, x2, y2 = map(int, input().split()) for j in range(3): if [x1, y1] == abc[j]: abc[j] = [x2, y2] ans = "NO" if abc == [[5, 8], [4, 8], [6, 8]]: ans = "YES" print(ans)