N = int(input()) f = [[-1] * 9 for _ in range(9)] d = [] for _ in range(N): x1, y1, x2, y2 = map(int, input().split()) if f[y1 - 1][x1 - 1] == -1: f[y2 - 1][x2 - 1] = len(d) + 1 d.append('{}{}'.format(x1 - 1, y1 - 1)) else: f[y2 - 1][x2 - 1] = f[y1 - 1][x1 - 1] f[y1 - 1][x1 - 1] = 0 a = [x for x in f[7][3:6] if x > 0] if len(a) == 3 and d[a[0] - 1] == '28' and d[a[1] - 1] == '17' and d[a[2] - 1] == '68': print('YES') else: print('NO')