//利用堆栈和MAP的映射关系 #include<iostream> using namespace std; #include<stack> #include<map> int main() { int n; while(cin>>n&&n) { map<int,int> m; stack<int> c; int m1,m2; for(int i=0;i<n;i++) { cin>>m1>>m2; m[m1]=m2; m[m2]=m1; } int k; for( k=1;k<=2*n;k++){ if(!c.empty()&&m[k]!=c.top()) c.push(k); else if(!c.empty()&&m[k]==c.top()) c.pop(); else c.push(k); } if(c.empty())cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }