#include using namespace std; int main(){ int n;cin>>n; int ax=2,ay=8,bx=3,by=9,cx=7,cy=9; for(int i = 0; n > i; i++){ int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2; if(x1 == ax && y1 == ay){ ax=x2;ay=y2; } if(x1 == bx && y1 == by){ bx=x2;by=y2; } if(x1 == cx && y1 == cy){ cx=x2;cy=y2; } //cout << endl; //cout << ax << " " << ay << " " << bx << " " << by << " " << cx << " " << cy << endl; } if(ax==5&&ay==8&&bx==4&&by==8&&cx==6&&cy==8)cout << "YES" << endl; else cout << "NO" << endl; } //5 8 4 8 6 8