#include using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 1000000000000 int main(){ int N; cin>>N; map,int> S; S[make_pair(2,8)]=1; S[make_pair(3,9)]=2; S[make_pair(7,9)]=3; for(int i=0;i>x1>>y1>>x2>>y2; if(!S.count(make_pair(x1,y1)))continue; int k = S[make_pair(x1,y1)]; S.erase(make_pair(x1,y1)); S[make_pair(x2,y2)] = k; } if(S[make_pair(5,8)]==1&&S[make_pair(4,8)]==2&&S[make_pair(6,8)]==3){ cout<<"YES"<