#include using namespace std; typedef long long ll; #define REP(i,n) for(int i=0; i #define VLL vector #define VVI vector> #define VVLL vector> #define VC vector #define VS vector #define VVC vector> #define VB vector #define VVB vector> #define fore(i,a) for(auto &i:a) typedef pair P; template bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1 << 30; const ll INFL = 1LL << 60; const ll mod = 998244353; int main() { vector> v; v.push_back({ 2,8 }); v.push_back({ 3,9 }); v.push_back({ 7,9 }); int n; cin >> n; REP(i, n) { int a, b, c, d; cin >> a >> b >> c >> d; REP(j, 3) { if (a == v[j].first&&b == v[j].second) { v[j] = { c,d }; } } } VB b(3, false); if (v[0].first == 5 && v[0].second == 8)b[0] = true; if (v[1].first == 4 && v[1].second == 8)b[1] = true; if (v[2].first == 6 && v[2].second == 8)b[2] = true; bool ans = true; REP(i, 3) { if (!b[i])ans = false; } if (ans)cout << "YES" << endl; else cout << "NO" << endl; }