/*** author: yuji9511 ***/
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << "\n"
typedef struct {
    ll a;
    ll b;

} P;

bool is_possible = false;
bool done[210][210] = {};

void check(ll last, ll minus1, vector<P> D){
    if(done[last][minus1]) return;
    done[last][minus1] = true;
    ll sz = D.size();
    rep(diff, 1, last/2+1){
        vector<P> d = D; 
        vector<P> d_new;
        ll cnt_1 = 0;
        ll mp[210] = {};
        ll start = last - 2 * diff + 1;
        bool ok = true;

        rep(i,0,sz){
            bool use = false;
            if(d[i].a == -1 && d[i].b == -1){
                cnt_1++;
            }else{
                if(d[i].a != -1 && d[i].b != -1){
                    if(d[i].a >= start && d[i].a <= start + diff-1 && d[i].a + diff == d[i].b){
                        mp[d[i].a]++;
                        mp[d[i].b]++;
                        use = true;
                    }else if(d[i].a >= start && d[i].a <= start + diff-1){
                        ok = false;
                    }else if(d[i].b >= start + diff && d[i].b <= last){
                        ok = false;
                    }
                }else if(d[i].b != -1){
                    if(d[i].b >= start+diff && d[i].b <= last){
                        mp[d[i].b]++;
                        mp[d[i].b - diff]++;
                        use = true;
                    }
                }else if(d[i].a != -1){
                    if(d[i].a >= start && d[i].a <= start + diff-1){
                        mp[d[i].a]++;
                        mp[d[i].a+diff]++;
                        use= true;
                    }
                }
                if(not use){
                    d_new.push_back(d[i]);
                }
            }

        }
        ll cnt_ok = 0;
        rep(i,start,last+1){
            if(mp[i] == 1){
                cnt_ok++;
            }else if(mp[i] >= 2){
                ok = false;
            }
        }
        if(not ok) continue;
        if(cnt_ok + cnt_1 * 2 >= diff * 2){
            if(diff == last/2){
                is_possible = true;
            }else{
                ll use = (2*diff - cnt_ok)/2;
                rep(i,0,cnt_1 - use) d_new.push_back({-1,-1});
                check(start-1, cnt_1 - use, d_new);
            }

        }
    }
}


void solve(){
    ll N;
    cin >> N;
    ll A[110], B[110];
    rep(i,0,N) cin >> A[i] >> B[i];
    vector<P> data;
    rep(i,0,N) data.push_back({A[i], B[i]});
    ll cnt = 0;
    rep(i,0,N){
        if(A[i] == -1 && B[i] == -1) cnt++;
    }

    check(2*N, cnt, data);
    if(is_possible){
        print("Yes");
    }else{
        print("No");
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

#include <cmath>
#include <queue>
#include <stack>

using namespace std;

#define LL long long

int n;
vector<int> a, b, c;
vector<int> e;
int zz = 0;

int main() {
	// std::ios::sync_with_stdio(false);
    // std::cin.tie(0);
	cin >> n;
	a = vector<int>(2 * n, 0);
	b = vector<int>(2 * n, 0);
	c = vector<int>(2 * n, 0);
	e = vector<int>(2 * n, -1);
	vector<int> ee = vector<int>(2 * n, 0);

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
		if (a[i] != -1) {
			// cout << "a = " << (a[i] - 1) << endl;
			if (e[a[i] - 1] != -1) {
				cout << "No" << endl;
				return 0;
			}
			e[a[i] - 1] = i;
			ee[a[i] - 1] = -1;
		}
		if (b[i] != -1) {
			// cout << "b = " << (b[i] - 1) << endl;
			if (e[b[i] - 1] != -1) {
				cout << "No" << endl;
				return 0;
			}
			e[b[i] - 1] = i;
			ee[b[i] - 1] = 1;
		}
		if (a[i] != -1 && b[i] != -1 && a[i] >= b[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	vector<int> f(n + 1, 0);
	f[0] = 1;
	// f[i]: 0 .. 2 * i - 1, can be dealt
	vector<bool> app(n, false);
	for (int i = 1; i <= n; ++i) {
		// for (int j = 0; j <= zz; ++j) {
		int tot = 0, totApp = 0, dis = 0;
		for (int ii = i - 1; ii >= 0; --ii) {
			for (int jj = 0; jj < app.size(); ++jj) {
				app[jj] = false;
			}
			if (!f[ii]) {
				continue;
			}
			// cout << "ii = " << ii << endl;
			dis = (i - ii); // also the number of persons in this region
			// consider ii * 2 and ii * 2 + 1
			// tot += 2;
			bool flag = true; 
			for (int jj = ii * 2; jj < ii * 2 + dis; ++jj) {
				if (ee[jj] == 1 || ee[jj + dis] == -1) {
					flag = false;
					break;
				}
				// cout << "jj = " << jj << endl;
				if (e[jj] != -1 && app[e[jj]]) {
					flag = false;
					break; 
				}
				if (e[jj + dis] != -1 && app[e[jj + dis]]) {
					flag = false;
					break;
				}
				if (e[jj] != -1) {
					if (e[jj + dis] != -1) {
						if (e[jj] != e[jj + dis]) {
							flag = false;
							break;
						}
					}
					app[e[jj]] = true;
				} else {
					if (e[jj + dis] != -1) {
						app[e[jj + dis]] = true;
					}
				}
			}
			if (flag) {
				// cout << i << " ok!" << endl;
				f[i] = true;
				break;
			}
		}
	}
	if (f[n]) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}