#include #define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++) int main( void ){ int n; if (!scanf( "%d", &n )) return 0; int array[ 3 ][ 2 ] = {{2, 8}, {3, 9}, {7, 9}}; const int array_goal[ 3 ][ 2 ] = {{5, 8}, {4, 8}, {6, 8}}; rep( i, 0, n ){ int x_pre, y_pre, x, y; if (!scanf( "%d%d%d%d", &x_pre, &y_pre, &x, &y )) return 0; rep( j, 0, 3 ){ if(array[ j ][ 0 ] == x_pre && array[ j ][ 1 ] == y_pre){ array[ j ][ 0 ] = x; array[ j ][ 1 ] = y; break; } } } rep(i,0,3){ rep(j,0,2){ if (array[i][j] != array_goal[i][j]){ printf("NO\n"); return 0; } } } printf("YES\n"); return 0; }