#!/bin/python n = input() x = 0 y = 0 matching = 0 result = True for i in xrange(n): point = map(int, raw_input().split()) if result == False: break; if i == 0: x = point[0]; y = point[1] elif i == 1: if point[0] == x and point[1] == y: continue if point[0] == x: matching = 0 elif point[1] == y: matching = 1 else: result = False break else: if matching == 0: if point[0] != x: result = False break if matching == 1 and point[1] != y: result = False break; if result: print 'YES' else: print 'NO'