#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    ll N;
    cin >> N;
    vl E(2 * N, -1), id(2 * N, -1), used(2 * N), se(N), A(N), B(N);
    rep(i, N) {
        cin >> A[i] >> B[i];
        if (A[i] > 0) A[i]--, id[A[i]] = i, used[A[i]]++;
        if (B[i] > 0) B[i]--, id[B[i]] = i, used[B[i]]++;
        if (A[i] >= 0 and B[i] >= 0) se[i] = 1; // 始点終点が決まっている

        if((A[i] >= 0 and B[i] >= 0) and A[i] > B[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    rep(i, 2 * N){
        if(used[i] > 1){
            cout << "No" << endl;
            return 0;
        }
    }

    rep(i, N) {
        if (A[i] == -1 or B[i] == -1) continue;
        ll d = B[i] - A[i];
        repe(j, A[i], B[i] + 1) {
            if(!(E[j] == -1 or E[j] == d)){
                cout << "No" << endl;
                return 0;
            }
            E[j] = d;
        }
    }

    vl pass(2 * N + 1);
    pass[0] = 1;
    rep(i, 2 * N - 1){
        if (!pass[i]) continue;
        // 選ぶ人数
        repe(n, 1, N + 1){
            if (i + 2 * n > 2 * N) break;
            bool isok = true;
            rep(j, n){
                if(id[i + j] == -1 and id[i + j + n] == -1){
                    continue;
                }else if(id[i + j] == -1){
                    if (se[id[i + j + n]]) isok = false;
                }else if(id[i + j + n] == -1){
                    if (se[id[i + j]]) isok = false;
                }else{
                    if (id[i + j] != id[i + j + n]) isok = false;
                }
                if (!isok) break;
            }
            if (isok) pass[i + 2 * n] = 1;
        }
    }

    cout << (pass[2 * N] ? "Yes" : "No") << endl;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define debug(x) cout << #x << ":\t" << x << endl;
const int N = 2e6 + 10;
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
int n;
int a[N], b[N];
int dp[1010][1010], vis[1010];
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		int l, r;
		scanf("%d%d", &l, &r);
		if (l != -1 && r != -1 && r <= l) { puts("No"); return 0; }
		if (l != -1) {
			if (vis[l]) { puts("No"); return 0; }
			a[l] = r;
			vis[l] = 1;
		}
		if (r != -1) {
			if (vis[r]) { puts("No"); return 0; }
			b[r] = l;
			vis[r] = 1;
		}
	}
	n <<= 1;
	for (int len = 2; len <= n; len += 2) {
		for (int i = 1; i <= n - len + 1; i++) {
			int j = i + len - 1;
			for (int k = i; k < j; k++) {
				if (dp[i][k] && dp[k + 1][j]) {
					dp[i][j] = 1;
					break;
				}
			}
			if (dp[i][j])continue;
			dp[i][j] = 1;
			for (int k = i; k <= i + len / 2 - 1; k++) {
				if (b[k]) {
					dp[i][j] = 0;
					break;
				}
				if (a[k]) {
					if (a[k] != -1 && a[k] - k != len / 2)dp[i][j] = 0;
					else {
						if (b[k + len / 2] && b[k + len / 2] != k)dp[i][j] = 0;
					}
				}
			}
			for (int k = i + len / 2; k <= j; k++) {
				if (a[k]) {
					dp[i][j] = 0;
					break;
				}
				if (b[k]) {
					if (b[k] != -1 && k - b[k] != len / 2)dp[i][j] = 0;
					else {
						if (a[k - len / 2] && a[k - len / 2] != k)dp[i][j] = 0;
					}
				}
			}
		}
	}
	puts(dp[1][n] ? "Yes" : "No");
	return 0;
}