#include #include #include using namespace std; int main() { int N; cin >> N; vector x1(N), y1(N), x2(N), y2(N); for (int i = 0; i < N; ++i) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; pair A = make_pair(2, 8), B = make_pair(3, 9), C = make_pair(7, 9); for (int i = 0; i < N; ++i) { if (A == make_pair(x1[i], y1[i])) A = make_pair(x2[i], y2[i]); if (B == make_pair(x1[i], y1[i])) B = make_pair(x2[i], y2[i]); if (C == make_pair(x1[i], y1[i])) C = make_pair(x2[i], y2[i]); } if (A == make_pair(5, 8) && B == make_pair(4, 8) && C == make_pair(6, 8)) cout << "YES" << endl; else cout << "NO" << endl; }