#include #include #include #include using namespace std; int main() { int N; cin >> N; vector> a{ { 2, 8 }, { 3, 9 }, { 7, 9 } }; for (int i = 0; i < N; ++i) { pair x1y1, x2y2; cin >> x1y1.first >> x1y1.second >> x2y2.first >> x2y2.second; vector>::iterator b = find(a.begin(), a.end(), x1y1); if (a.end() != b) *b = x2y2; } if (a[0] == make_pair(5, 8) && a[1] == make_pair(4, 8) && a[2] == make_pair(6, 8)) cout << "YES"; else cout << "NO"; }