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