// #define _GLIBCXX_DEBUG #include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) int main() { // Input int N; cin >> N; vector x1(N), y1(N), x2(N), y2(N); rep(i, N) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; // Simulate pair koma[3] = {{2, 8}, {3, 9}, {7, 9}}; rep(i, N) { rep(j, 3) { if (koma[j] == make_pair(x1[i], y1[i])) { koma[j] = {x2[i], y2[i]}; break; } } } // Judge pair _koma[3] = {{5, 8}, {4, 8}, {6, 8}}; bool ok = true; rep(i, 3) if (koma[i] != _koma[i]) ok = false; // Output cout << (ok ? "YES" : "NO") << endl; }