#!/bin/python import sys n = int(raw_input().strip()) xx = None horizontal = True yy = None vertical = True for a0 in xrange(n): x,y = raw_input().strip().split(' ') x,y = [int(x),int(y)] if not xx: xx = x yy = y else: if x != xx: vertical = False if y != yy: horizontal = False if not horizontal and not vertical: print "NO" break if horizontal or vertical: print "YES"