#include #define REP(i, start, end) for (int i=start, i##Len=(end); i < i##Len; ++i) using ll = int64_t; int main() { using namespace std; cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); int N; cin >> N; int board[10][10]; board[2][8] = 1; board[3][9] = 2; board[7][9] = 3; int x1, y1, x2, y2; REP(i, 0, N) { 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]) cout << "YES" << endl; else cout << "NO" << endl; return 0; }