#!/usr/bin/env/ python # -*- coding:utf-8 -*- N = raw_input() N = int(N) rc = [] for i in range(N): ra,ca,rb,cb = raw_input().split() ra = int(ra) ca = int(ca) rb = int(rb) cb = int(cb) rc.append([ra,ca]) rc.append([rb,cb]) #print rc rc_uniq = [] for x in rc: if x not in rc_uniq: rc_uniq.append(x) #print rc_uniq if N <= len(rc_uniq): print 'YES' else: print 'NO'