#define _USE_MATH_DEFINES #include using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; pair pos[3] = {{2, 8}, {3, 9}, {7, 9}}; for (int i = 0; i < n; i++) { pair from, to; cin >> from.first >> from.second; cin >> to.first >> to.second; for (int j = 0; j < 3; j++) { if (pos[j] == from) { pos[j] = to; break; } } } if (pos[0] == make_pair(5, 8) && pos[1] == make_pair(4, 8) && pos[2] == make_pair(6, 8)) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }