P1 = 28 P2 = 39 P3 = 79 for _ in range(int(input())): a, b, c, d = map(int, input().split()) x = 10*a + b y = 10*c + d if x == P1: P1 = y if x == P2: P2 = y if x == P3: P3 = y print(['NO', 'YES'][P1 == 58 and P2 == 48 and P3 == 68])