# Read the number of moves n = int(input()) # Initialize positions of A, B, C a_pos = (2, 8) b_pos = (3, 9) c_pos = (7, 9) for _ in range(n): x1, y1, x2, y2 = map(int, input().split()) current_from = (x1, y1) # Check if the move is for any of the tracked pieces if current_from == a_pos: a_pos = (x2, y2) elif current_from == b_pos: b_pos = (x2, y2) elif current_from == c_pos: c_pos = (x2, y2) # Target positions target_a = (5, 8) target_b = (4, 8) target_c = (6, 8) # Check if all are in correct positions if a_pos == target_a and b_pos == target_b and c_pos == target_c: print("YES") else: print("NO")