class Point: def __init__(self, column, row) -> None: self.column = column self.row = row def __eq__(self, __o: object) -> bool: return self.column == __o.column and self.row == __o.row def __ne__(self, __o: object) -> bool: return not self.__eq__(__o) def main(): N = int(input()) hisha = Point(2, 8) right_gin = Point(3, 9) left_gin = Point(7, 9) for _ in range(N): before_c, before_r, after_c, after_r = map(int, input().split()) before_point = Point(before_c, before_r) after_point = Point(after_c, after_r) if before_point == hisha: hisha = after_point if before_point == left_gin: left_gin = after_point if before_point == right_gin: right_gin = after_point if hisha == Point(5, 8) and left_gin == Point(6, 8) and right_gin == Point(4, 8): print("YES") else: print("NO") if __name__ == "__main__": main()