#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int n; cin >> n; if(n<2 || n>10){ cout<<"NO"; return 0; } int first=0; int yes=0; int search_x=0; int sx=0; int sy=0; int search_y=0; for(int a0 = 0; a0 < n; a0++){ int x; int y; cin >> x >> y; if(x>10 || x<-10 || y>10 || y<-10){ yes=1; break; } else if(first==0){ search_x=x; search_y=y; first=1; } else if(first==1){ if(x==search_x){ first=2; sx=1; } else if(y==search_y){ first=2; sy=1; } else{ yes=1; break; } } else if(first==2){ if(sx==1){ if(x != search_x){ yes=1; break; } } else if(sy==1){ if(y != search_y){ yes=1; break; } } } } if(yes==0 ) cout<<"YES"; else cout<<"NO"; return 0; }