#!/bin/python3 import sys n = int(input().strip()) points = [] for a0 in range(n): x,y = input().strip().split(' ') x,y = [int(x),int(y)] points.append([x,y]) vertical, horizontal = True, True for index, point in enumerate(points): if index == 0: last_x, last_y = point[0], point[1] else: if last_x != point[0]: horizontal = False if last_y != point[1]: vertical = False if horizontal is False and vertical is False: break print('YES' if horizontal or vertical else 'NO')