list_points = [] for _ in xrange(input()): x, y = raw_input().split(' ') list_points.append((x, y)) x1 = list_points[0][0] y1 = list_points[0][1] flagx = 1 flagy = 1 for i in list_points: if i[0] != x1: flagx = 0 break for i in list_points: if i[1] != y1: flagy = 0 break if flagx == 1 or flagy == 1: print 'YES' else: print 'NO'