//
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef pair<int,pint> ppint;
typedef pair<ll,pll> ppll;
typedef vector<int> vint;
typedef vector<ll> vll;

const double pi=3.141592653589793;
const int INF10 = 1000000001;
const ll INF15 = 1e15 +1;
const long long INF18 = 1e18 + 1;
const int mod = 1000000007;
//const int mod = 998244353;
const double EPS=0.00001;

#define rep(i, n) for (int i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (ll)(n); i++)
#define rep2(i,start,end) for(int i=(ll)start;i<=(ll)end;i++)
#define vrep(i, n) for(int i=(ll)n-1;i>=0;i--)
#define vrep1(i, n) for(int i=(ll)n;i>0;i--)
#define all(n) n.begin(),n.end()
#define pb push_back
#define debug(x) cerr << #x <<": " << x << '\n'
#define arep(it,a) for(auto it : a )

struct edge{
    edge(int s,int e,long long c){
        to=e;from=s;cost=c;
    }
    edge(int i,long long c=1){
        edge(-1,i,c);
    }
    int from;
    int to;
    long cost;
};
typedef vector<edge> edges;

//bを何回足せばaを超えるか(O(a/b))
//a+b-1/bとすればよし

//2進数表示したときの最高桁(O(log n))
template<class M>
M bi_max(M n){ M m = 0; for (m; (1 << m) <= n; m++); return m-1; }
//bi_eに二進数表示したやつを代入(O(log^2 n))
//bitset<N> a(n)でnの二進数表示が得られて、a[i]=0or1でi番目のfragが立ってるかわかる
//x^n mod m (nが負の時は０)(O(log n))
template<class M,class N,class L>
common_type_t<M,N,L> myPow(M a,N b,L m=mod){
    common_type_t<M,N,L> res=1;
    while(b!=0){
        if(b & 1)(res*=a)%=m;
        b>>=1;
        (a*=a)%=m;
    }return res%m;
}
template<class T>
bool maxin (T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool minin (T &a,T b){if(a>b){a=b;return 1;}return 0;}
template<class M,class N> 
common_type_t<M,N> mygcd(M a,N b){
    a=abs(a);b=abs(b);
    if(a < b) return mygcd(b, a);
    M r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}
template<class M,class N>
common_type_t<M,N> mylcm(M a,N b){
    return (a/mygcd(a,b))*b;
}

const int N_MAX=100005;
int n;
vint a,b,dp,mem;

void Main(){
    int x=0,y=INF10,z=1;
    //入力
    bool ng=false;
    cin>>n;
    mem.resize(2*n+1,0);
    dp.resize(2*n+1,0);
    rep(i,n){
        cin>>x>>y;
        a.pb(x);b.pb(y);
        if(x!=-1){
            if(mem[x]!=0)ng=true;
            mem[x]=i+1;
        }
        if(y!=-1){
            if(mem[y]!=0)ng=true;
            mem[y]=-(i+1);
        }
    }
    //処理
    if(ng){
        cout << "No" <<endl;
        return;
    }
    bool tof;
    dp[0]=1;
    rep1(p,2*n-1){
        if(!dp[p-1])continue;
        rep1(j,2*n){
            int q=p+2*j-1;
            if(q>2*n)break;
            tof=true;
            rep2(l,p,q){
                if(mem[l]!=0){
                    if(mem[l]<0){
                        int m=-mem[l]-1;
                        if( a[m]!=-1 && ( a[m]<p || a[m]!=l-j ) ){tof=false;break;}
                        else if( a[m]==-1 &&( l-j<p || mem[l-j]!=0 )){tof=false;break;}
                    }else if(mem[l]>0){
                        int m=mem[l]-1;
                        if( b[m]!=-1 && ( b[m]>q || b[m]!=l+j ) ){tof=false;break;}
                        else if(b[m]==-1 &&( l+j>q || mem[l+j]!=0)){tof=false;break;}
                    } 
                }
            }
            if(tof)dp[q]=true;
        }
    }
    //出力
    dp[2*n]?cout << "Yes" <<endl:cout << "No" <<endl;;
}

int main(){
    cin.tie(nullptr);
    cout<<fixed<<setprecision(12);
    Main();
}
#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
typedef long long ll;
const int N=105;
struct man{
	int a,b;
}A[N];
int D[N],F[N<<1];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	
	int n,i,l,r,a,b;
	scanf("%d",&n);
	rep(i,1,n)scanf("%d%d",&A[i].a,&A[i].b);
	D[0]=1;
	rep(r,1,n){
		REP(l,0,r)if(D[l]){
			//printf("(%d,%d]\n",l<<1,r<<1);
			rep(i,1,n<<1)F[i]=0;
			rep(i,1,n)if(~(A[i].a&A[i].b)){
				if(~(A[i].a|A[i].b)){
					//printf("%d %d\n",A[i].a,A[i].b);
					if(A[i].b<=A[i].a)break;
					if(A[i].b<=l+l||A[i].a>r+r){}
					else if(A[i].b==A[i].a+r-l&&A[i].a>l+l&&A[i].a<=l+r){
						if(F[A[i].a]||F[A[i].b])break;
						F[A[i].a]=F[A[i].b]=1;
					}else break;
				}else{
					if(~A[i].a){
						if(A[i].a<=l+l||A[i].a>r+r)continue;
						//printf("%d ?\n",A[i].a);
						if(A[i].a> l+r)break;
						if(F[A[i].a    ])break;F[A[i].a    ]=1;
						if(F[A[i].a+r-l])break;F[A[i].a+r-l]=1;
					}else{
						if(A[i].b<=l+l||A[i].b>r+r)continue;
						//printf("? %d\n",A[i].b);
						if(A[i].b<=l+r)break;
						if(F[A[i].b    ])break;F[A[i].b    ]=1;
						if(F[A[i].b+l-r])break;F[A[i].b+l-r]=1;
					}
				}
			}
			//printf("(%d,%d] ans=%d\n",l<<1,r<<1,i>n);
			if(i>n){D[r]=1;break;}
		}
		//printf("D[%d]=%d\n",r,D[r]);
	}
	if(D[n])puts("Yes");else puts("No");
	return 0;
}