#include using namespace std; int main() { int N; cin >> N; int board[10][10]; for (int i = 0;i < 10;++ i) for (int j = 0;j < 10;++ j) board[i][j] = 0; board[2][8] = 1; board[3][9] = 2; board[7][9] = 3; while(N-- > 0) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; board[x2][y2] = board[x1][y1]; board[x1][y1] = 0; } if (board[5][8] == 1 && board[4][8] == 2 && board[6][8] == 3) cout << "YES" << endl; else cout << "NO" << endl; return 0; }