#include <bits/stdc++.h>
using namespace std;

struct level{  
  int type; //-1 = left, 1 = right
  int id; 
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  int N;
  cin >> N;
  vector<level> e(2 * N + 1);
  vector<bool> dp(2 * N + 1);
  dp[0] = true;
  for(int i = 0; i < N; i++){  
    int a, b;
    cin >> a >> b;
    if(a != -1){  
      if(e[a].type != 0){  
        cout << "No" <<endl; 
        return 0;
      }
      e[a].type = -1; 
      e[a].id = i+1;
    }
    if(b != -1){  
      if(e[b].type != 0){  
        cout << "No" <<endl; 
        return 0;
      }
      e[b].type = 1;
      e[b].id = i+1;
    }
  }
  //*
  for(int i = 0; i <= 2 * N; i++){  
    //cout << i << " " <<  e[i].id << " " << e[i].type << endl;
  }
  //*/
  for(int i = 0; i <= 2 * N; i+=2){  
    if(dp[i]){  
      for(int j = i + 2; j <= 2 * N; j+=2){  
        //cout << "j " << j <<endl;
        bool bad = false;
        int length = (j - i) / 2;
        for(int t = i+1; t <= i + length; t++){  
          //cout << "t " << t <<endl;
          if(e[t].type == 1 || e[t+length].type == -1){  
            //cout << "bad due to type" <<endl;
            bad = true; 
            break;
          }
          if(e[t].id != 0 && e[t+length].id != 0){
            if(e[t+length].id != e[t].id){  
              //cout << "bad due to id" <<endl;
              bad = true; 
              break;
            }
          }
        }
        if(!bad) dp[j] = true;
      } 
    } 
  }
  /*
  for(int i = 0; i <= 2 * N + 1; i++){  
    cout << dp[i] << " "; 
  }
  cout <<endl;
  //*/
  if(dp[2*N]) cout << "Yes" <<endl;   
  else cout << "No" <<endl;
}

#include<bits/stdc++.h> 
using namespace std;
namespace Ruri{
    #define ms(a,b) memset(a,b,sizeof(a))
    #define repi(i,a,b) for(int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ?
    #define repd(i,a,b) for(int i=a,bbb=b;i>=bbb;--i)
    #define reps(s) for(int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
    #define ce(i,r) i==r?'\n':' '
    #define pb push_back 
    #define all(x) x.begin(),x.end()
    #define gmn(a,b) a=min(a,b)
    #define gmx(a,b) a=max(a,b)
    #define fi first
    #define se second                         
    typedef long long ll;
    typedef unsigned long long ull;
    typedef double db;
    const int infi=1e9;//infi较大，注意涉及inf相加时爆int
    const ll infl=4e18;
    inline ll ceil_div(ll a,ll b){ return (a+b-1)/b; }
    inline ll pos_mod(ll a,ll b){ return (a%b+b)%b; }
    //std::mt19937 rnd(time(0));//std::mt19937_64 rnd(time(0));
}
using namespace Ruri;
namespace Read{
    #define ss(a) scanf("%s",a)
    inline int ri(){ int x; scanf("%d",&x); return x; }
    inline ll rl(){ ll x;  scanf("%lld",&x); return x; }
    inline db rd(){ db x; scanf("%lf",&x); return x; }
}
namespace DeBug{
    #define pr(x) cout<<#x<<": "<<(x)<<endl
    #define pra(x,a,b) cout<<#x<<": "<<endl; \
            repi(i,a,b) cout<<x[i]<<" ";     \
            puts("");   
    #define FR(a) freopen(a,"r",stdin)
    #define FO(a) freopen(a,"w",stdout)
}
using namespace Read;
using namespace DeBug;
const int MAX_N=205;
int n,a[MAX_N],b[MAX_N];
int belong[MAX_N],w[MAX_N];
bool dp[MAX_N][MAX_N];
bool Check()
{
	ms(belong,-1);
	repi(i,1,n){
		if(a[i]!=-1){
			if(belong[a[i]]!=-1) return false;
			belong[a[i]]=0;
		}
		if(b[i]!=-1){
			if(belong[b[i]]!=-1) return false;
			belong[b[i]]=1;
		}
		if(a[i]!=-1&&b[i]!=-1){
			if(a[i]>b[i]) return false;
			w[a[i]]=w[b[i]]=b[i]-a[i];
		}
	}
	repi(len,1,n)for(int st=1;st+2*len-1<=2*n;st+=2){
		int ed=st+2*len-1;
		dp[st][ed]=true;
		repi(i,st,st+len-1){
			if(belong[i]==1) dp[st][ed]=false;
			if(w[i]&&w[i]!=len) dp[st][ed]=false;
			if(!w[i]&&belong[i]==0&&belong[i+len]==1) dp[st][ed]=false; 
		}
		repi(i,st+len,ed){
			if(belong[i]==0) dp[st][ed]=false;
			if(w[i]&&w[i]!=len) dp[st][ed]=false;
		}
		for(int i=st+1;i<ed;i+=2)if(dp[st][i]&&dp[i+1][ed]) dp[st][ed]=true;
	}
	return dp[1][2*n];
}
int main()
{
	n=ri();
	repi(i,1,n) a[i]=ri(),b[i]=ri();
	puts(Check()?"Yes":"No");
    return 0;
}