#include <iostream>
int a[100];
int b[100];
int used[200];
int main() {
    int n;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> a[i] >> b[i];
        if (a[i] != -1) ++used[a[i] - 1];
        if (b[i] != -1) ++used[b[i] - 1];
        if (a[i] != -1 and b[i] != -1 and a[i] >= b[i]) {
            std::cout << "No\n";
            return 0;
        }

        if (a[i] != -1 and used[a[i] - 1] == 2) {
            std::cout << "No\n";
            return 0;
        }

        if (b[i] != -1 and used[b[i] - 1] == 2) {
            std::cout << "No\n";
            return 0;
        }
    }
    int ilen, jlen, idx;
    for (int i = 0; i < n; ++i) {
        for (int j = i - 4; j < n; ++j) {
            if (i == j) continue;
            if (j < 0) continue;
            if (a[i] == -1 or b[i] == -1) continue;
            if (a[i] <= a[j] and a[j] <= b[i] and a[i] <= b[j] and b[j] <= b[i]) {
                std::cout << "No\n";
                return 0;
            }

            if (b[j] != -1) {
                if (a[i] <= a[j] and a[j] <= b[i]) {
                    ilen = b[i] - a[i] + 1;
                    jlen = b[j] - a[j] + 1;
                    if (ilen != jlen) {
                        std::cout << "No\n";
                        return 0;
                    }
                }
            } else {
                if (a[i] <= a[j] and a[j] <= b[i]) {
                    ilen = b[i] - a[i];
                    idx = a[j] + ilen - 1;
                    if (idx < 0 or 2 * n <= idx or used[idx] == 1) {
                        std::cout << "No\n";
                        return 0;
                    }
                }
            }

            if (a[j] != -1) {
                if (a[i] <= b[j] and b[j] <= b[i]) {
                    ilen = b[i] - a[i] + 1;
                    jlen = b[j] - a[j] + 1;
                    if (ilen != jlen) {
                        std::cout << "No\n";
                        return 0;
                    }
                }
            } else {
                if (a[i] <= b[j] and b[j] <= b[i]) {
                    ilen = b[i] - a[i];
                    idx = b[j] - ilen - 1;
                    if (idx < 0 or 2 * n <= idx or used[idx] == 1) {
                        std::cout << "No\n";
                        return 0;
                    }
                }
            }
        }
    }
    std::cout << "Yes\n";
}
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<numeric>
#include<cstring>
#include<random>
#include<array>
#include<fstream>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include<queue>

/*
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) std::cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", (double)v)

template<typename A, typename B>void mins(A& a, const B& b) { a = min(a, (A)b); };
template<typename A, typename B>void maxs(A& a, const B& b) { a = max(a, (A)b); };





int main() {
	ll N; cin >> N;
	vector<ll> A(N), B(N);
	REP(i, 0, N) cin >> A[i] >> B[i];
	
	vector<ll> T(2 * N + 1, 0);
	REP(i, 0, N) {
		if (A[i] != -1) {
			if (T[A[i]] != 0) {
				PRI("No");
				return 0;
			}

			T[A[i]] = i+1;
		}
		if (B[i] != -1) {
			if (T[B[i]] != 0) {
				PRI("No");
				return 0;
			}

			T[B[i]] = -(i+1);
		}
		if (A[i] != -1 && B[i] != -1 && B[i] <= A[i]) {
			PRI("No");
			return 0;
		}
	}

	vector<ll> dp(2 * N + 1, false);
	dp[0] = true;
	REP(i, 0, 2 * N) {
		if (!dp[i]) continue;

		for (int k = i + 2; k <= 2 * N; k += 2) {
			int d = (k - i) / 2;

			bool ok = true;
			for (int j = i + 1; j <= k; j++) {
				if (T[j] > 0 && (j + d > 2 * N || (T[j + d] != 0 && T[j] != -T[j + d]))) {
					ok = false;
					break;
				}
				if (T[j] < 0 && (j - d <= i || (T[j - d] != 0 && T[j - d] != -T[j]))) {
					ok = false;
					break;
				}
			}
			if (!ok) continue;

			dp[k] = true;
		}
	}

	if (dp[2 * N]) PRI("Yes");
	else PRI("No");

	return 0;
}
