#include using namespace std; int main(){ int N; cin>>N; pair A={2,8}; pair B={3,9}; pair C={7,9}; for (int i=0;i>x>>y>>z>>w; if (x==A.first && y==A.second){ A={z,w}; } else if (x==B.first && y==B.second){ B={z,w}; } else if (x==C.first && y==C.second){ C={z,w}; } } if (A.first==5 && A.second==8 && B.first==4 && B.second==8 && C.first==6 && C.second==8){ cout<<"YES"; } else{ cout<<"NO"; } }