/*input
2
4 1
2 4
*/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> in(n*2), out(n*2), c(n*2);
  bool ok = true;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    if (a == 2*n || b == 1) {
      ok = false;
      continue;
    }
    --a; --b;
    if (a >= 0) {
      if (in[a]) ok = false;
      if (b < 0) in[a] = 1;
      else in[a] = -1;
    }
    if (b >= 0) {
      if (out[b]) ok = false;
      if (a < 0) out[b] = 1;
      else out[b] = -1;
    }
    if (a >= 0 && b >= 0) {
      int nc = b-a;
      for (int i = a; i <= b; ++i) {
        if (c[i] != 0 && c[i] != nc) ok = false;
        c[i] = nc;
      }
    }
  }
  auto f = [&] {
    rep(i, n*2-1) {
      if (in[i] == 1) {
        int j = i+1;
        for (; j < n*2; ++j) {
          if (c[j] > 0) {
            j = i+c[j];
            if (out[j] == 1) ok = false;
            break;
          }
          else if (out[j] == 0 && in[j] == 0) {
            out[j] = 1;
            break;
          }
        }
        if (j == n*2) {
          ok = false;
          continue;
        }
        for (int k = i; k <= j; ++k) {
          if (c[k] != 0 && c[k] != j-i) ok = false;
          c[k] = j-i;
        }
      }
    }
  };
  reverse(in.begin(), in.end());
  reverse(out.begin(), out.end());
  reverse(c.begin(), c.end());
  swap(in, out);
  f();
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}
#include <bits/stdc++.h>
using namespace std;

const int maxN=100;

int n;

int arr[2*maxN+1];
int type[2*maxN+1]={0};

int main() {
	// your code goes here
	
	int n;
	cin>>n;

    memset(arr,-1,sizeof(arr));

    int a,b;
    
    
    int rem=0;
    
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        
        if(a==-1 && b==-1)
        {
            rem++;
        }
        else if(a==-1 && type[b]==0)
        {
            type[b]=1;
        }
        else if(b==-1 && type[a]==0)
        {
            type[a]=2;
        }
        else if(b>a && type[a]==0 && type[b]==0)
        {
            type[a]=3;
            type[b]=3;
            
            arr[a]=b;
            arr[b]=a;
        }
        else
        {
            cout<<"No"<<endl;
            return 0;
        }
    }

    bool dp[2*n+2];
    dp[2*n+1]=true;
    
    int temp[2*n+1];
    
    for(int i=2*n;i>=1;i--)
    {
        dp[i]=false;
        
        for(int j=i;j<=2*n;j++)
        {
            if(j%2!=i%2 && dp[j+1])
            {
                int mid=(i+j)/2;
                
                int len=(j-i+1)/2;
                
                for(int k=i;k<=mid;k++)
                {
                    temp[k]=k+len;
                    temp[k+len]=k;
                }
                
                bool ff=1;
                
                for(int k=i;k<=j;k++)
                {
                    if(type[k]==0)
                    {
                        continue;
                    }
                    else if(type[k]==1)
                    {
                        if(type[temp[k]]!=0 || k<=mid)
                        {
                            ff=0;
                        }
                    }
                    else if(type[k]==2)
                    {
                        if(type[temp[k]]!=0 || k>mid)
                        {
                            ff=0;
                        }
                    }
                    else
                    {
                         if(arr[k]!=temp[k])
                         {
                             ff=0;
                         }
                    }
                }

                
                dp[i] |=ff;
            }
        }
    }
    
    cout<<(dp[1] ? "Yes" : "No")<<endl;
	return 0;
}
