#include <bits/stdc++.h>
using namespace std;
using lint         = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n;
    cin >> n;
    vector<int> a(n), b(n);
    map<int, int> cnt;
    vector<pair<int, char>> pos(2 * n + 1, pair<int, char>(-1, 'N'));
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        cnt[a[i]]++;
        cnt[b[i]]++;
        if (a[i] != -1)
            pos[a[i]] = {b[i], 'L'};
        if (b[i] != -1)
            pos[b[i]] = {a[i], 'R'};
    }
    for (auto &p : cnt) {
        if (p.first != -1 && p.second >= 2) {
            cout << "No"
                 << "\n";
            return 0;
        }
    }
    vector<bool> dp(2 * n + 1, false);
    dp[0] = true;
    for (int i = 2; i <= 2 * n; ++i) {
        for (int j = i - 2; j >= 0; j -= 2) {
            if (!dp[j])
                continue;
            bool ok   = true;
            int width = (i - j) / 2;
            for (int k = j + 1; k <= i; ++k) {
                auto c = pos[k];
                if (k < j + 1 + width) { // left
                    if (c.second == 'R' || (c.second == 'L' && (c.first != -1 && c.first != k + width)))
                        ok = false;
                    if (c.second == 'L' && c.first == k + width)
                        if (!(pos[k + width].second == 'R' && pos[k + width].first == k))
                            ok = false;
                    if (c.second == 'L' && c.first == -1)
                        if (pos[k + width].second != 'N')
                            ok = false;
                } else { // right
                    if (c.second == 'L' || (c.second == 'R' && (c.first != -1 && c.first != k - width)))
                        ok = false;
                    if (c.second == 'R' && c.first == k - width)
                        if (!(pos[k - width].second == 'L' && pos[k - width].first == k))
                            ok = false;
                    if (c.second == 'R' && c.first == -1)
                        if (pos[k - width].second != 'N')
                            ok = false;
                }
            }
            if (ok) {
                dp[i] = true;
                break;
            }
        }
    }
    if (dp[2 * n])
        cout << "Yes"
             << "\n";
    else
        cout << "No"
             << "\n";
    return 0;
}
#include<bits/stdc++.h>
#define register
#define N 201
#define INFs 0x3f3f3f3f
using namespace std;
int n,a[N],b[N],sum[N],tot;
inline void Add(int x){if(~x){++sum[x];++tot;if(sum[x]>1){puts("No");exit(0);}}}
int main(void){
	int i,j,k,T=0;scanf("%d",&n);
	for(i=1;i<=n;++i){
		scanf("%d%d",a+i,b+i);
		if((~a[i]&&~b[i]&&a[i]>b[i])||(~a[i]&&(++sum[a[i]]>1))||(~b[i]&&(++sum[b[i]]>1)))return puts("No"),0;
		tot+=(a[i]!=-1)+(b[i]!=-1);
	}
	while(1){
		for(i=1;i<=n;++i)if(~a[i]&&~b[i]){
			for(j=1;j<=n;++j){
				if(a[j]>a[i]&&a[j]<b[i]){
					if(b[j]==-1)Add(b[j]=a[j]+b[i]-a[i]);else if(b[j]!=a[j]+b[i]-a[i])return puts("No"),0;
				}//a夹中间
				if(b[j]>a[i]&&b[j]<b[i]){
					if(a[j]==-1)Add(a[j]=b[j]-b[i]+a[i]);else if(a[j]!=b[j]-b[i]+a[i])return puts("No"),0;
				}//b夹中间
			}
		}++T;if(T>=100)break;
//		for(i=1;i<=n;++i)printf("%d %d\n",a[i],b[i]);
	}puts("Yes");
	return 0;
}