#include #define int long long #define double long double using namespace std; const int MOD = 1000000007; const int INF = 1e14; using Graph = vector>; signed main(){ int N; cin >> N; vector board(9); for( int i = 0; i < 9; i++ ) board[i] = "........."; board[1][7] = 'A'; board[2][8] = 'B'; board[6][8] = 'C'; for( int i = 0; i < N; i++ ){ int a, b, c, d; cin >> a >> b >> c >> d; a--; b--; c--; d--; swap(board[a][b], board[c][d]); } if( board[4][7] =='A' && board[3][7] == 'B' && board[5][7] == 'C' ) cout << "YES" << endl; else cout << "NO" << endl; }