#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <decimal/decimal>
using namespace std;
using namespace __gnu_pbds;

#define rep(i, s, t) for (int i = s; i < int(t); ++i)

#define sc	scanf
#define pr	printf
#define ff	first
#define ss	second
#define mp	make_pair
#define pb	push_back
#define eb	emplace_back
#define range(c)	c.begin(), c.end()
#define lowbit(x)	((x) & -(x))
#define pop_count	__builtin_popcount
#define pop_count_64	__builtin_popcountll
#define tail_count	__builtin_ctz
#define tail_count_64	__builtin_ctzll
#define lead_count	__builtin_clz
#define lead_count_64	__builtin_clzll

#define TEMP template<typename
#define CONST(type) constexpr type const

TEMP... Ts> struct is_con { static CONST(bool) value = false; };
TEMP... Ts> struct is_con<vector<Ts...>> { static CONST(bool) value = true; };
TEMP... Ts> struct is_con<list<Ts...>> { static CONST(bool) value = true; };
TEMP... Ts> struct is_con<deque<Ts...>> { static CONST(bool) value = true; };
TEMP... Ts> struct is_con<set<Ts...>> { static CONST(bool) value = true; };
TEMP... Ts> struct is_con<unordered_set<Ts...>> { static CONST(bool) value = true; };
TEMP... Ts> struct is_con<map<Ts...>> { static CONST(bool) value = true; };
TEMP... Ts> struct is_con<unordered_map<Ts...>> { static CONST(bool) value = true; };

TEMP T1, typename T2> ostream& operator<<(ostream& os, pair<T1, T2> const& p) { return os << "<" << p.ff << "," << p.ss << ">"; }
TEMP T> typename enable_if<is_con<T>::value, ostream>::type& operator<<(ostream& os, T const& c) {
	os << "{";
	bool first = true;
	for (auto const& x : c) {
		if (first) first = false;
		else os << ",";
		os << " " << x;
	}
	return os << " }";
}

TEMP T, typename... Ts> void dbg(T h, Ts... t) { cerr << " " << h; dbg<Ts...>(t...); }
template<> void dbg<int>(int x) { cerr << endl; }

#ifdef LOCAL
#define debug(...) cerr << "[ "#__VA_ARGS__" ] :", dbg(__VA_ARGS__, 0)
#else
#define debug(...) 0
#endif

TEMP T, typename U> using ordered_map = tree<T, U, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
TEMP T> using ordered_set = ordered_map<T, null_type>;

typedef long long i64;
typedef decimal::decimal128 i99;
typedef unsigned int u32;
typedef unsigned long long u64;
typedef float f32;
typedef double f64;
typedef long double f80;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<i64> vl;

TEMP T> T& minn(T& lhs, T const& rhs) { return lhs = min(lhs, rhs); }
TEMP T> T& maxx(T& lhs, T const& rhs) { return lhs = max(lhs, rhs); }

constexpr const u32 maxn = 205U;

bool ok[maxn][maxn], ans[maxn];
u32 other[maxn], cnt[maxn];
char side[maxn];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	u32 n;
	std::cin >> n;
	u32 more = false;
	for (u32 i = 0; i != n; ++i) {
		u32 a, b;
		std::cin >> a >> b;
		if (~a) {
			other[a] = b;
			side[a] = 'a';
			++cnt[a];
		}
		if (~b) {
			other[b] = a;
			side[b] = 'b';
			++cnt[b];
		}
	}
	for (u32 i = 1; i <= n + n; ++i) {
		if (cnt[i] > 1U) {
			std::cout << "No" << std::endl;
			return 0;
		}
	}
	for (u32 i = 1; i != n + n; ++i) {
		for (u32 j = i + 1, l = 1; j <= n + n; j += 2, ++l) {
			ok[i][j] = true;
			for (u32 k = 0; k != l; ++k) {
				ok[i][j] &= side[i + k] != 'b';
			}
			for (u32 k = i + l; k <= j; ++k) {
				ok[i][j] &= side[k] != 'a';
			}
			for (u32 k = 0; k != l; ++k) {
				if (other[i + k]) {
					ok[i][j] &= ~other[i + k] ? other[i + k] == i + k + l : !other[i + k + l];
				}
				else {
					ok[i][j] &= !other[i + k + l] || !~other[i + k + l];
				}
			}
		}
	}
	ans[0] = true;
	for (u32 i = 2; i <= n + n; ++i) {
		for (u32 j = 1; j < i; j += 2) {
			ans[i] |= ans[j - 1] && ok[j][i];
		}
	}
	std::cout << (ans[n + n] ? "Yes" : "No") << std::endl;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <limits>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
template<class T> inline int  sz(T &a) { return a.size(); }
using ll = long long; using ld = long double;
using pi = pair<int,int>; using pl = pair<ll,ll>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
const int inf = numeric_limits<int>::max();
const ll infll = numeric_limits<ll>::max();
int main()
{
  int n; cin >> n;
  using pll = pair<pl,ll>;
  vector<pll> p(n);
  rep(i,n) {
    cin >> p[i].first.first >> p[i].first.second;
    p[i].second = i;
  }
  sort(p.begin(),p.end(), [](pll a, pll b){
    return a.first.first > b.first.first;
  });

  vl res;
  map<pl,ll> mp;
  ll a = p[0].second, b = p[n-1].second;
  ll c = max(abs(p[0].first.first - p[n-1].first.first), abs(p[0].first.second - p[n-1].first.second));
  if(a > b) swap(a, b);
  if(mp[{a,b}] == 0) {
    mp[{a, b}]++;
    res.push_back(c);
  }

  a = p[1].second; b = p[n-1].second;
  c = max(abs(p[1].first.first - p[n-1].first.first), abs(p[1].first.second - p[n-1].first.second));
  if(a > b) swap(a, b);
  if(mp[{a,b}] == 0) {
    mp[{a, b}]++;
    res.push_back(c);
  }

  a = p[0].second; b = p[n-2].second;
  c = max(abs(p[0].first.first - p[n-2].first.first), abs(p[0].first.second - p[n-2].first.second));
  if(a > b) swap(a, b);
  if(mp[{a,b}] == 0) {
    mp[{a, b}]++;
    res.push_back(c);
  }

  sort(p.begin(),p.end(), [](pll a, pll b){
    return a.first.second > b.first.second;
  });

  a = p[0].second; b = p[n-1].second;
  c = max(abs(p[0].first.first - p[n-1].first.first), abs(p[0].first.second - p[n-1].first.second));
  if(a > b) swap(a, b);
  if(mp[{a,b}] == 0) {
    mp[{a, b}]++;
    res.push_back(c);
  }

  a = p[1].second; b = p[n-1].second;
  c = max(abs(p[1].first.first - p[n-1].first.first), abs(p[1].first.second - p[n-1].first.second));
  if(a > b) swap(a, b);
  if(mp[{a,b}] == 0) {
    mp[{a, b}]++;
    res.push_back(c);
  }

  a = p[0].second; b = p[n-2].second;
  c = max(abs(p[0].first.first - p[n-2].first.first), abs(p[0].first.second - p[n-2].first.second));
  if(a > b) swap(a, b);
  if(mp[{a,b}] == 0) {
    mp[{a, b}]++;
    res.push_back(c);
  }

  sort(res.begin(),res.end(), [](ll a, ll b){
    return a > b;
  });
  cout << res[1] << "\n";

  return 0;
}
