#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <unordered_map>
#include <cstdio>
#include <climits>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, a[110], b[110];
bool d[210];
bool bl[210];
pair<int, int> p[210];

signed main() {
	std::random_device rnd;
	std::mt19937_64 mt(rnd());
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i] >> b[i];
	for (int i = 0; i < n; i++) {
		if (0 < a[i] && 0 < b[i] && a[i] >= b[i]) {
			cout << "No" << endl;
			return 0;
		}
		if ((0 < a[i] && bl[a[i]]) || (0 < b[i] && bl[b[i]])) {
			cout << "No" << endl;
			return 0;
		}
		if (0 < a[i]) {
			bl[a[i]] = true;
			p[a[i]] = make_pair(i, 1);
		}
		if (0 < b[i]) {
			bl[b[i]] = true;
			p[b[i]] = make_pair(i, 2);
		}
	}
	d[0] = true;
	for (int i = 0; i < 2 * n; i++) {
		if (!d[i])continue;
		for (int j = i + 2; j <= 2 * n; j += 2) {
			bool bo = true;
			for (int k = 0; k < n; k++)if (0 < a[k] && 0 < b[k] && (a[k] <= i && i < b[k] && b[k] <= j) || (i < a[k] && a[k] <= j && j < b[k]))bo = false;
			int q = (j - i) / 2;
			for (int k = i + 1; k <= i + q; k++) {
				if (p[k].second&&p[k + q].second) {
					if (p[k].first != p[k + q].first)bo = false;
				}
				else if (p[k].second) {
					if (p[k].second == 2)bo = false;
				}
				else if (p[k + q].second) {
					if (p[k + q].second == 1)bo = false;
				}
			}
			if (bo)d[j] = true;
		}
	}
	if (d[2 * n])cout << "Yes" << endl;
	else cout << "No" << endl;
}
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 210;
#define int ll
const long double pi = 3.14159265358979323846;

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

void YES(bool ok){
    cout << (ok ? "Yes" : "No") << endl;
    exit(0);
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<Pll> v(2 * n, {-1, -1});
    rep(i, 0, n) {
        ll a,b; cin >> a >> b;
        if(a != -1){
            a--;
            if (v[a] != Pll{-1, -1}) YES(false);
            v[a] = {0, i};
        }
        if(b != -1){
            b--;
            if (v[b] != Pll{-1, -1}) YES(false);
            v[b] = {1, i};
        }
        if(a != -1 && b != -1){
            if (a > b) YES(false);
        }
    }

    // [l, r]の区間を正しく補完できるかチェック
    auto check = [&](ll l, ll r) {
        if (l & 1) return false;
        if (~r & 1) return false;

        ll len = (r - l + 1) / 2;
        bool res = true;

        rep(i, l, r + 1){
            ll j;
            if (i <= (l + r) / 2) {
                j = i + len;
                res &= v[i].first != 1;
                if(v[i] != Pll{-1, -1} && v[j] != Pll{-1, -1}){
                    res &= v[j].first == 1 && v[i].second == v[j].second;
                }
            } else {
                j = i - len;
                res &= v[i].first != 0;

                if (v[i] != Pll{-1, -1} && v[j] != Pll{-1, -1}) {
                    res &= v[j].first == 0 && v[i].second == v[j].second;
                }
            }
        }


        if (res) debug(l, r);
        return res;
    };

    bitset<n_max> dp(0);
    rep(i,0,2 * n){
        if (~i & 1) continue;

        rep(j, 0, i) {
            if (!dp[j]) continue;
            if (check(j + 1, i)){
                dp[i] = 1;
                break;
            }
        }
        if (check(0, i)) dp[i] = 1;
    }
    debug(dp);
    YES(dp[2 * n - 1]);
}