N = int( input() ) R0 = [] C0 = [] R1 = [] C1 = [] bag = set() for i in range( N ): r0, c0, r1, c1 = map( int, input().split() ) R0.append( r0 ) C0.append( c0 ) bag.add( ( r0, c0 ) ) R1.append( r1 ) C1.append( c1 ) bag.add( ( r1, c1 ) ) if len( bag ) + 1 <= N: print( "NO" ) else: print( "YES" )