#include <bits/stdc++.h>
#define all(n) (n).begin(), (n).end()
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define sqr(n) (n)*(n)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef double db;

template<class T1, class T2> bool umin(T1& a, T2 b) { return a > b ? (a = b, true) : false; }
template<class T1, class T2> bool umax(T1& a, T2 b) { return a < b ? (a = b, true) : false; }
template<class T> void clear(T& a) { T().swap(a); }

const int N = 2e2 + 5, inf = 1 << 30;

int n, m, _, k;
int v[N];
bool f[N >> 1][N >> 1];

int main() {
    IOS; cin >> n;
    bool flag = 0;
    rep(i, 1, n) {
        int a, b; cin >> a >> b; --a, --b;
        if (a == -2 && b == -2) continue;
        if (a == -2) { if (v[b]) flag = 1; v[b] = -N; }
        else if (b == -2) { if (v[a]) flag = 1; v[a] = N; }
        else { 
            if (b <= a) flag = 1; 
            if (v[a] || v[b]) flag = 1;
            v[a] = b - a; v[b] = a - b;
        }
    }
    if (flag) { cout << "No"; return 0; }
    rep(i, 1, n)
        rep(j, 0, n - i) {
            if (!f[j][i + j]) rep(k, j + 1, i + j - 1) if (f[j][k] && f[k][j + i]) { f[j][i + j] = 1; break; }
            if (!f[j][i + j]) {
                f[j][i + j] = 1;
                rep(k, j << 1, (j << 1) + i - 1)
                    if (!(v[k] == i & v[k + i] == -i) && !(v[k] == N && !v[k + i]) && !(!v[k] && v[k + i] == -N) && !(!v[k] && !v[k + i])) {
                        f[j][i + j] = 0;
                        break;
                    }
        }
    }
    if (f[0][n]) cout << "Yes";
    else cout << "No";
    return 0;
}
/*
  In the name of ALLAH
  Author : Raashid Anwar
*/

#include <bits/stdc++.h>
using namespace std;
 
#define int int64_t
const int M1 =  998244353;
const int M2 =  1000000007;
mt19937 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());

void solve() {
  int n;
  cin >> n;
  
  vector <int> l(n), r(n);
  map <int, set <int>> mp;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    mp[l[i]].insert(i);
    mp[r[i]].insert(i);
  }

  vector <int> dp(n + n + 1, 0);
  dp[0] = 1;
  for (int li = 1; li < n + n; li++) {
    for (int k = 1; li + k - 1 + k <= n + n; k++) {
    //out << " ====> { " << li << ", " << k << " } <====\n";
      if (dp[li - 1]) {
        if (dp[li + k - 1 + k])
          continue;
        dp[li + k - 1 + k] = 1;
        for (int i = li; i < li + k && dp[li + k - 1 + k]; i++) {
          set <int> s;
          for (int x : mp[i])
            s.insert(x);
          for (int x : mp[i + k])
            s.insert(x);
          dp[li + k - 1 + k] &= ((int)s.size() <= 1);
          for (int x : s) {
            if (l[x] != -1 && l[x] != i)
              dp[li + k - 1 + k] = 0;
            if (r[x] != -1 && r[x] != i + k)
              dp[li + k - 1 + k] = 0;
          }
        }
        //cout << "{ " << li << ", " << li + k - 1 + k << " } ==> " << dp[li + k - 1 + k] << "\n";
      }
    }
  }
  cout << (dp[n + n]? "Yes": "No") << "\n";
}

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}