• + 0 comments

    !/bin/python3

    import math import os import random import re import sys

    if name == 'main': n = int(input()) H = [] V = []

    for n_itr in range(n):
        xy = input().split()
    
        x = int(xy[0])
    
        y = int(xy[1])
    
        H.append(xy[0])
        V.append(xy[1])
    setH = set(H)
    setV = set(V)
    if len(setH) == 1 or len(setV) == 1:
        print("YES")
    else:
        print("NO")