#include "bits/stdc++.h"

#define all_of(x) std::begin(x), std::end(x)
#ifdef _GLIBCXX_DEBUG
    #define debug(x) cerr << #x << ": " << x << endl
#else
    #define debug(x) 
#endif

using namespace std;

using LL = long long;

template<typename T>
ostream& operator << (ostream& out, const vector<T>& v) {
    out << "[";
    for(const auto& x : v) {
        out << x << ", ";
    }
    return out << "]";
}
template<typename T>
istream& operator >> (istream& in, vector<T>& v) {
    for(auto& x : v) {
        in >> x;
    }
    return in;
}

template<typename S, typename T>
ostream& operator << (ostream& out, const pair<S, T>& p) {
    return out << "{" << p.first << ", " << p.second << "}";
}

int N;
vector<int> A, B;

int memo[200][200];
bool solve(int n, int f) {
    if(memo[n][f] != -1) {
        return memo[n][f];
    }
    if(n == N) {
        return memo[n][f] = (f == 0);
    }
    if(f == N - n) {
        return memo[n][f] = true;
    }
    int M = 0;
    vector<int> A0, B0;
    int is_first = -1;
    for(int i = 0; i < int(A.size()); ++i) {
        if(B[i] != -1 and A[i] >= B[i]) {
            return memo[n][f] = false;
        }
        if((A[i] == -1 or A[i] >= 2 * n) and (B[i] == -1 or B[i] >= 2 * n)) {
            A0.push_back(A[i]);
            B0.push_back(B[i]);
            ++M;
            if(A[i] == 2 * n) {
                is_first = M - 1;
            }
        }
    }
    if(M + f != N - n) {
        return memo[n][f] = false;
    }
    auto foo = [&](int i, int a, int b) {
        int c = b + b - a;
        if(b <= a or c > 2 * N) {
            return false;
        }
        vector<bool> V(b - a, false);
        V[0] = true;
        for(int m = 0; m < M; ++m) {
            if(m == i) {
                continue;
            }
            if((a <= A0[m] and A0[m] < c) or (a <= B0[m] and B0[m] < c)) {
                if(A0[m] != -1) {
                    if(B0[m] != -1 and B0[m] - A0[m] != b - a) {
                        return false;
                    }
                    if(A0[m] >= b or V[A0[m] - a]) {
                        return false;
                    }
                    V[A0[m] - a] = true;
                } else {
                    if(B0[m] < b or V[B0[m] - b]) {
                        return false;
                    }
                    V[B0[m] - b] = true;
                }
            }
        }
        int f0 = f;
        for(auto x : V) {
            if(not x) {
                --f0;
            }
        }
        if(f0 < 0) {
            return false;
        }
        return solve(c / 2, f0);
    };
    if(is_first >= 0) {
        if(B0[is_first] != -1) {
            return memo[n][f] = foo(is_first, 2 * n, B0[is_first]);
        } else {
            for(int b = A0[is_first] + 1; b < 2 * N; ++b) {
                if(foo(is_first, 2 * n, b)) {
                    return memo[n][f] = true;
                }
            }
            return memo[n][f] = false;
        }
    } else {
        for(int i = 0; i < M; ++i) {
            if(A0[i] == -1) {
                if(foo(i, 2 * n, B0[i])) {
                    return memo[n][f] = true;
                }
            }
        }
        if(f > 0) {
            --f;
            for(int b = 2 * n + 1; b < 2 * N; ++b) {
                if(foo(-1, 2 * n, b)) {
                    return memo[n][f + 1] = true;
                }
            }
            return memo[n][f + 1] = false;
        }
        return memo[n][f] = false;
    }
}


    
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    memset(memo, -1, sizeof(memo));
    
    cin >> N;
    int free_cnt = 0;
    for(int n = 0; n < N; ++n) {
        int a, b;
        cin >> a >> b;
        if(a == -1 and b == -1) {
            ++free_cnt;
        } else {
            A.push_back(max(-1, a - 1));
            B.push_back(max(-1, b - 1));
        }
    }
    
    cout << ((solve(0, free_cnt)) ? ("Yes") : ("No")) << "\n";
    
    return 0;
}

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <numeric>

/* debug macros */
#ifdef WAFDAYO
#define DBG_LINE() {std::cerr<<"\e[2m[L"<<__LINE__<<"]\e[m ";}
#define DBG_PRINT(s,t,u) {std::cerr<<(s)<<" \e[2m=\e[m \e[1m"<<(t)<<"\e[m"<<(u);}
#define SELECT_7TH(x1,x2,x3,x4,x5,x6,x7,...) x7
#define dbg1(x1) DBG_PRINT(#x1,x1,std::endl)
#define dbg2(x1,x2) DBG_PRINT(#x1,x1,", ")dbg1(x2)
#define dbg3(x1,x2,x3) DBG_PRINT(#x1,x1,", ")dbg2(x2,x3)
#define dbg4(x1,x2,x3,x4) DBG_PRINT(#x1,x1,", ")dbg3(x2,x3,x4)
#define dbg5(x1,x2,x3,x4,x5) DBG_PRINT(#x1,x1,", ")dbg4(x2,x3,x4,x5)
#define dbg6(x1,x2,x3,x4,x5,x6) DBG_PRINT(#x1,x1,", ")dbg5(x2,x3,x4,x5,x6)
#define dbg(...) DBG_LINE()\
SELECT_7TH(__VA_ARGS__,dbg6,dbg5,dbg4,dbg3,dbg2,dbg1)(__VA_ARGS__)
#else
#define dbg(...) {}
#endif

/* utility functions */
struct read_item{read_item(){};
template<class T>operator T(){T t;std::cin>>t;return t;}};
char splf(int i,int n){return(i+1<n)?' ':'\n';};
template<bool up>
struct _RI{int i;_RI(int a):i(a){}
int operator*(){return i;}void operator++(){i+=(up?1:-1);}
bool operator!=(const _RI& r){return up?i<r.i:i>=r.i;}};
template<bool up>
struct _RX{_RI<up> x,y;_RI<up> begin(){return x;}_RI<up> end(){return y;}
_RX(int a,int b):x(up?a:(a-1)),y(b){}_RX(int a):_RX(up?0:a,up?a:0){}};
typedef _RX<true> range;
typedef _RX<false> revrange;

/* types and constants */
typedef int64_t i64;
typedef uint64_t u64;
// const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;

using namespace std;

bool between(int x, int lo, int hi) {
	return lo <= x && x < hi;
}

bool check(int lo, int n, vector<pair<int,int>> &recs) {

	if(lo == n) {
		return true;
	}

	for(auto c : range(1, n + 1)) {

		int mid = lo + c;
		int hi = lo + c * 2;
		if(hi > n) {
			break;
		}

		bool ok = true;
		vector<int> spaces(c);

		for(auto& rec : recs) {
			int a = rec.first;
			int b = rec.second;
			if(!between(a, lo, hi) && !between(b, lo, hi)) {
				continue;
			}
			if(a < 0) {
				a = b - c;
			}
			if(b < 0) {
				b = a + c;
			}
			bool bad = (b - a != c) || !between(a, lo, mid) || !between(b, mid, hi) || spaces[a - lo];
			if(bad) {
				ok = false;
				break;
			}
			spaces[a - lo] = true;
		}

		if(ok && check(hi, n, recs)) {
			return true;
		}
	}

	return false;
}

int main() {

	const int N = read_item();
	vector<pair<int,int>> recs(N);
	for(auto i : range(N)) {
		recs[i].first = (int)read_item() - 1;
		recs[i].second = (int)read_item() - 1;
	}

	bool ok = check(0, 2 * N, recs);
	printf("%s\n", ok ? "Yes" : "No");

	return 0;
}

/* wafdayo~~~ */
