/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */


#include<bits/stdc++.h>

using namespace std;

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

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CFairElevator {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> a(n), b(n);

      rep(i, n) {
        cin >> a[i] >> b[i];
      }

      vector<bool> ok(n+1);
      ok[0] = true;

      for(int k=0; k<n; k++) {
        if (!ok[k]) continue;

        for(int j=k+1; j<=n; j++) {
          int left = k*2;
          int right = j*2;
          int diff = j-k;
          // (left , right]
          vector<int> us(2*n+1);
          bool flag = true;
          rep(i, n) {
            if (a[i] != -1) {
              if (us[a[i]]) {
                flag = false;
                break;
              } else {
                us[a[i]] = true;
              }
            }
            if (b[i] != -1) {
              if (us[b[i]]) {
                flag = false;
                break;
              } else {
                us[b[i]] = true;
              }
            }
            if (a[i] == -1 && b[i] == -1) continue;

            if (a[i] == -1 && b[i] > left && b[i] <= right) {
              int pos = b[i] - diff;
              if (pos <= left || us[pos]) {
                flag = false;
                break;
              } else {
                us[pos] = true;
              }
            }
            if (b[i] == -1 && a[i] > left && a[i] <= right) {
              int pos = a[i] + diff;
              if (pos > right || us[pos]) {
                flag = false;
                break;
              } else {
                us[pos] = true;
              }
            }
            if (a[i] == -1 || b[i] == -1) continue;
            if (b[i] <= left) continue;
            if (a[i] > right) continue;

            if (a[i] > left && b[i] <= right) {
              if (b[i] - a[i] != diff) {
                flag = false;
                break;
              }
            } else {
              flag = false;
              break;
            }
          }

          if (flag) {
            ok[j] = true;
            if (j==n) {
              cout << "Yes" << endl;
              return;
            }
          }
        }
      }

      cout << "No" << endl;

    }
};

signed main() {
  CFairElevator solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
#include<bits/stdc++.h>

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}
int n;
vector<int> A,B,in,out;
map<int,int> mp;

bool Recc(int p,int l){
  static bool mm[201][101];
  static bool vs[201][101];
  if(vs[p][l])return mm[p][l];
  vs[p][l] = 1;
  bool f = true;
  for(int i = 0; i < l && f; ++i){
    if(p+i+l >= 2*n){f = false;break;}    
    f &= (in[p+i]<0 || out[p+i+l]<0) || in[p+i] == out[p+i+l];
    f &= out[p+i]<0 && in[p+i+l]<0;
    if((mp.count(in[p+i])&&mp[in[p+i]] != l) || (mp.count(out[p+i+l])&&mp[out[p+i+l]] != l))f = false;
  }
  return mm[p][l] = f;
}

bool Rec(int p){
  if(p >= 2*n)return true;
  static bool rmm[201];
  static bool rvs[201];
  if(rvs[p])return rmm[p];
  rvs[p] = 1;
  bool f = false;
  for(int i = 1; i < 101; ++i){
    bool g = Recc(p,i);
    if(!g)continue;
    f = Rec(p+i*2);
    if(f)break;
  }
  return rmm[p] = f;
}

int main(){
  cin >> n;
  B = A = vector<int>(n);
  in = out = vector<int>(n+n,-1);
  bool fff = true;
  bitset<1000> cnt;
  for(int i = 0; i < n; ++i){
    cin >> A[i] >> B[i];A[i]--;B[i]--;
    if(A[i]>=0){
      if(cnt[A[i]])fff = false;
      cnt[A[i]] = 1;
    }
    if(B[i]>=0){
      if(cnt[B[i]])fff = false;
      cnt[B[i]] = 1;
    } 
    if(B[i]>=0&&A[i]>=0&&A[i] >= B[i])fff = false;
    if(A[i] >= 0)in[A[i]] = i;
    if(B[i] >= 0)out[B[i]] = i;
    if(A[i] >= 0 && B[i] >= 0)mp[i] = B[i] - A[i];
  }
  // for(int i = 0; i < n+n; ++i){
  //   debug(in[i]);
  //   debug(out[i]);
  // }
  cout << (fff&&Rec(0) ? "Yes" : "No") << endl;
  return 0;
}
