#include int a[10][10]; int main() { int N; std::cin >> N; for (int i = 0; i <= 9; ++i) { for (int j = 0; j <= 9; ++j) { a[i][j] = 0; } } a[2][8] = 1; a[3][9] = 2; a[7][9] = 3; for (int i = 0; i < N; ++i) { int x0, y0, x1, y1; std::cin >> x0 >> y0 >> x1 >> y1; a[x0][y0] ^= a[x1][y1]; a[x1][y1] ^= a[x0][y0]; a[x0][y0] ^= a[x1][y1]; } if (a[5][8] == 1 && a[4][8] == 2 && a[6][8] == 3) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } }