#!/bin/python3 import sys _x = None _y = None vertical_line = True horizontal_line = True same_line = True n = int(input().strip()) for a0 in range(n): x,y = input().strip().split(' ') x,y = [int(x),int(y)] if not _x or not _y: _x, _y = x, y if (_x != x and _y != y): same_line = False elif (x != x) and horizontal_line: vertical_line = False elif (y != y) and vertical_line: horizontal_line = False if same_line: print("YES") else: print("NO")