#include using namespace std; int main(){ int n,lx,ly,x,y; cin >> n; for(int i = 0; i < n; i++){ cin >> x >> y; if(i&&x!=lx&&y!=ly){ cout<<"NO"; return 0; } if(i&&x==lx&&y!=ly){ y=100; } else if(i&&x!=lx&&y==ly){ x=100; } lx=x; ly=y; } cout<<"YES"; return 0; }