#!/bin/python3 import sys n = int(input().strip()) points = [] for a0 in range(n): x,y = input().strip().split(' ') points.append((int(x),int(y))) hor = True ver = True x0, y0 = points[0] for x, y in points[1:]: if ver and x != x0: ver = False if hor and y != y0: hor = False if not (ver or hor): break print("YES" if ver or hor else "NO")