
#include <bits/stdc++.h>

const int MAXN = 200;

int A[MAXN + 5], B[MAXN + 5];
int P[MAXN + 5], D[MAXN + 5];
bool Dp[MAXN + 5][MAXN + 5];

bool Check(int l, int r) {
	int mid = (l + r) >> 1, len = mid - l + 1;
	for (int i = l; i <= r; i++) {
		if (P[i]) {
			if (P[i] != -1) {
				if (P[i] < l || P[i] > r)
					return false;
				if (P[i] > i && P[i] - i != len)
					return false;
			}
			else {
				if (D[i] == 1 && (i > mid || P[i + len]))
					return false;
				if (D[i] == -1 && (i <= mid || P[i - len]))
					return false;
			}
		}
	}
	return true;
}

bool Read(int N) {
	for (int i = 1; i <= N; i++) {
		int l, r; scanf("%d%d", &l, &r);
		if (l == -1 && r == -1)
			continue;
		if (l == r) return false;
		if (l != -1) {
			if (P[l]) return false;
			P[l] = r, D[l] = 1;
		}
		if (r != -1) {
			if (P[r]) return false;
			P[r] = l, D[r] = -1;
		}
	}
	return true;
}

int main() {
	int N;
	scanf("%d", &N);
	if (!Read(N))
		return puts("No"), 0;
	N <<= 1;
	for (int len = 2; len <= N; len += 2) {
		for (int i = 1; i + len - 1 <= N; i++) {
			int j = i + len - 1;
			for (int k = i + 1; k < j; k += 2) {
				if (Dp[i][k] && Dp[k + 1][j]) {
					Dp[i][j] = true;
					break;
				}
			}
			if (!Dp[i][j]) Dp[i][j] = Check(i, j);
		}
	}
	puts(Dp[1][N] ? "Yes" : "No");
	return 0;
}

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar()
#define pc(x) putchar(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=char(n%10+48);n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

#ifndef ONLINE_JUDGE
template<typename T>
void pr(T a){std::cerr<<a<<std::endl;}
template<typename T,typename... Args>
void pr(T a, Args... args) {std::cerr<<a<<' ',pr(args...);}
#else
template<typename... Args>
void pr(Args... args){}
#endif

using namespace std;
const int MM = 205;

int n, cnt[MM], l[MM], r[MM], at[MM], no, dp[MM][MM], aa;

int main(){
	scan(n);
	for(int i = 1; i <= n; i++){
		scan(l[i], r[i]);
		if(l[i] == -1)
			l[i] = 0;
		else{
			cnt[l[i]]++;
			at[l[i]] = i;
		}
		if(r[i] == -1)
			r[i] = 0;
		else{
			cnt[r[i]]++;
			at[r[i]] = i;
		}

		if(l[i] and r[i] and l[i] > r[i])
			no = 1;

		// assert(l[i] or r[i]);
		if(!l[i] and !r[i]){
			aa++;
		}
	}
	dp[0][0] = 1;
	for(int i = 1; i <= 2*n; i++){
		if(!cnt[i]){
			for(int t = 0; t <= 2*n; t++)
				dp[i][t] |= dp[i-1][t];
		}
		if(!cnt[i] and !cnt[i-1] and i > 2){
			for(int t = 1; t <= 2*n; t++)
				dp[i][t] |= dp[i-2][t-1];
		}
		// pr("i", i);
		for(int j = 1; j < i; j++){
			if((i-j+1)%2 || !dp[j-1]) continue;
			int len = (i-j+1)/2;
			// pr("j", j, len);
			int ok = 1, add = 0;
			for(int k = j; k < j+len; k++){
				// pr("k", k, ok);
				if(at[k] and at[k+len]){
					if(at[k] != at[k+len])
						ok = 0;
				}
				else if(at[k]){
					int id = at[k];
					if(r[id])
						ok = 0;
					// r[id] = k+len;
					// cnt[k+len]++;
				}
				else if(at[k+len]){
					int id = at[k+len];
					if(l[id])
						ok = 0;
					// l[id] = k;
					// cnt[k]++;
				}
				else{
					//add an extra "free" one into here
					add++;
				}
			}
			if(ok){
				for(int t = add; t <= 2*n; t++)
					dp[i][t] |= dp[j-1][t-add];
			}
		}
	}
	int ans = dp[2*n][aa];

	for(int i = 0; i <= 2*n; i++){
		// print(cnt[i], dp[i]);
		if(cnt[i] > 1)
			no = 1;
	}
	if(no)
		ans = 0;

	puts(ans ? "Yes" : "No");
}