// source code of submission 781937, Zhongshan University Online Judge System #include <iostream> #include <cstring> #include <stack> using namespace std; int couple[200020]; int main() { int n,i,a,b; while(cin>>n,n) { stack <int> s; memset(couple,0,sizeof(couple)); for(i = 0;i < n;i++) { cin>>a>>b; if(a < b) couple[b] = a; else couple[a] = b; } for(i = 1;i <= 2*n;i++) { if(!couple[i]) s.push(i); else if(s.top()!=couple[i]) break; else s.pop(); } if(s.empty()) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }