i, n, f, r = 1, int(input()), [1, 1], ['NO', 'YES'] x1, y1 = map(int, input().split()) while i < n and (f[0] or f[1]): i += 1 x, y = map(int, input().split()) f[0] &= x == x1 f[1] &= y == y1 print(r[f[0] or f[1]])