#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
using namespace std;

#define LL long long
#define DB double
#define MAXN 200
#define Pr pair<int,int>
#define X first
#define Y second
#define INF 1000000001
#define mem(x,v) memset(x,v,sizeof(x))

LL read(){
    LL x=0,F=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*F;
}

int n,a[MAXN+5],b[MAXN+5],dp[MAXN+5],F;
int ta[MAXN+5],tb[MAXN+5];
int vis[MAXN+5];

bool check(int l,int r){
	int L=(r-l+1)/2;
	for(int i=1;i<=n;i++)ta[i]=a[i],tb[i]=b[i];
	for(int i=1;i<=2*n;i++)vis[i]=0;
	for(int i=1;i<=n;i++)
	if(ta[i]!=-1||tb[i]!=-1){
		if(ta[i]==-1){
			ta[i]=tb[i]-L;
			if(!(tb[i]>=l&&tb[i]<=r))continue;
		}
		else if(tb[i]==-1){
			tb[i]=ta[i]+L;
			if(!(ta[i]>=l&&ta[i]<=r))continue;
		}
		if((ta[i]>=l&&ta[i]<=r)^(tb[i]>=l&&tb[i]<=r))
		return 0;
		if((ta[i]>=l&&ta[i]<=r)&&(tb[i]>=l&&tb[i]<=r)){
			if(tb[i]-L!=ta[i])return 0;
			if(vis[ta[i]]||vis[tb[i]])return 0;
			vis[ta[i]]=vis[tb[i]]=1;
		}
	}
	return 1;
}

int main(){
	n=read();
	for(int i=1;i<=n;i++)a[i]=read(),b[i]=read();
	dp[0]=1;
	for(int r=2;r<=2*n;r+=2)
		for(int l=r-1;l>=1;l-=2)
		if(dp[l-1]&&check(l,r)){dp[r]=1;break;}
	printf("%s",dp[2*n]?"Yes":"No");
}
#include <bits/stdc++.h>

#define ln                 '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 2e2;
bool f[nsz + 5];
char s[nsz + 5];
int n, fm[nsz + 5], l[nsz + 5], r[nsz + 5];

void inline exit_with(bool can) {
	printf(can ? "Yes\n" : "No\n");
	exit(0);
}

bool inline chk(int l, int r) {
	int md = (l + r) >> 1;
	circ (i, l, md) if (s[i] == ')') return 0;
	circ (i, md + 1, r) if (s[i] == '(') return 0;
	circ (i, l, md) if (fm[i] && ::r[fm[i]] != -1 && ::r[fm[i]] != i + md - l + 1) return 0;
	circ (i, md + 1, r) if (fm[i] && ::l[fm[i]] != -1 && ::l[fm[i]] != i - md + l - 1) return 0;
	circ (i, l, md) {
		int j = i + md - l + 1;
		if (fm[i] && fm[j] && fm[i] != fm[j]) return 0; 
	}
	return 1;
}

int main() {
	scanf("%d", &n);
	cont (i, 2 * n) s[i] = '?';
	cont (i, n) {
		int l, r;
		scanf("%d%d", &l, &r);
		if ((l != -1 && s[l] != '?') || (r != -1 && s[r] != '?')) exit_with(0);
		if (l != -1) s[l] = '(';
		if (r != -1) s[r] = ')';
		::l[i] = l, ::r[i] = r;
		fm[l] = fm[r] = i;
	}
	f[0] = 1;
	cont (i, 2 * n) {
		for (int j = i - 1; j >= 0; --j) {
			if ((i - j) % 2 == 1) continue;
			f[i] |= f[j] & chk(j + 1, i);
		}
	}
	exit_with(f[2 * n]);
}