#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),(OUT(YES),1),(OUT(NO),0))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 5010;
const int SIZE3 = 430;
const int SIZE = 300;
const int MAPSIZE = 40;
const LL p998 = 998244353;
const LL p107 = 1000000007;
const LL p = p107;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
//LL A[SIZE],B[SIZE],C[SIZE];
LL pai[SIZE];
bool reached[SIZE][SIZE];
bool dp[SIZE][SIZE];
bool isA[SIZE];
bool isB[SIZE];
bool able(int a,int b){
	if(a>=b) return false;
	if((b-a)%2) return false;
	if(reached[a][b]) return dp[a][b];
	reached[a][b]=true;
	FOR(i,a,b){
		if(able(a,i) and able(i,b)) dp[a][b]|=true;
	}
	if(dp[a][b]) return true;
	LL len=(b-a)/2;
	FOR(i,a,a+len){
		if(isB[i]) return false;
		if(pai[i]!=-1 and pai[i]!=i+len) return false;
	}
	FOR(i,a+len,b){
		if(isA[i]) return false;
		if(pai[i]!=-1 and pai[i]!=i-len) return false;
		if(isB[i] and isA[i-len] and pai[i]==-1) return false;
	}
	return dp[a][b]=true;
}
LL counts[SIZE];
LL solve(){
	cin >> N;
	REP(i,2*N+1) pai[i]=-1;
	REP(i,N){
		LL a,b;
		cin >>a >> b;
		if(a!=-1 and b!=-1){
			if(b<a) return false;
			pai[a]=b;
			pai[b]=a;			
		}
		if(b!=-1){
			isB[b]=true;
			counts[b]++;
		}
		if(a!=-1){
			counts[a]++;
			isA[a]=true;
		}
	}
	REP(i,2*N+1) if(counts[i]>=2) return false;
	return able(1,2*N+1);
	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	LL T=1;

	REP(i,T){
		YesNo;
	}
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 1e2 + 5;

int a[MAXN], b[MAXN];

int main(void)
{
	int n;
	scanf("%d",&n);
	for(int i=1; i<=n; ++i) scanf("%d%d",&a[i],&b[i]);
	
	static int seq[MAXN*2];
	static bool has[MAXN];
	for(int i=1; i<=n; ++i)
	{
		if(a[i] != -1)
		{
			if(seq[a[i]]) return printf("No"), 0;
			seq[a[i]] = i;
		}
		if(b[i] != -1)
		{
			if(seq[b[i]]) return printf("No"), 0;
			seq[b[i]] = -i;
		}
		if(a[i] != -1 && b[i] != -1)
		{
			if(a[i] > b[i]) return printf("No"), 0;
			has[i] = 1;
		}
	}
	
	static bool can[MAXN*2];
	can[0] = 1;
	
	for(int i=1; i<=n*2; ++i)
	{
		for(int j=i&1; j<i; j+=2) if(can[j])
		{
			int len = (i-j)/2;
			bool flag = 1;
			for(int k=1; k<=len && flag; ++k)
			{
				int x = seq[j+k], y = seq[j+len+k];
				if(!x && !y) continue;
				if(x<0){ flag = 0; break;}
				if(y>0){ flag = 0; break;}
				if(x && y && x != -y){ flag = 0; break;}
				
				if(x && !y && has[x]){ flag = 0; break;}
				if(!x && y && has[-y]){ flag = 0; break;}
			}
			if(flag){ can[i] = 1; break;}
		}
	}
	
	if(can[n*2]) printf("Yes");
	else printf("No");
	return 0;
}