#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(ll x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { ll d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll modpow(ll x, ll p) { ll result = 1, now = 1, pm = x; while (now<=p) { if (p&now) { result = result * pm % MOD; } now*=2; pm = pm*pm % MOD; } return result; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

struct person { ll A, B; };

int main() {
  ll N; cin >> N;
  ll A[N], B[N]; rep(i,N) { cin >> A[i] >> B[i]; if (A[i]!=-1) A[i]--; if (B[i]!=-1) B[i]--; }
  ll from[N*2] = {}; rep(i,N) if (A[i]!=-1) from[A[i]]++;
  ll to[N*2] = {}; rep(i,N) if (B[i]!=-1) to[B[i]]++;
  rep(i,N) if (A[i]!=-1&&B[i]!=-1&&A[i]>=B[i]) { cout << "No" << endl; return 0; }
  rep(i,N*2) if (from[i]+to[i]>=2) { cout << "No" << endl; return 0; }

  bool ok[N*2][N*2] = {}; rep(i,N*2) repr(j,i+1,N*2) ok[i][j] = true;
  rep(i,N) {
    if (A[i]!=-1) {
      rep(j,N*2) {
        ok[j][A[i]] = false;
        if (to[j]) ok[A[i]][j] = false;
      }
    }
    if (B[i]!=-1) {
      rep(j,N*2) {
        ok[B[i]][j] = false;
        if (to[j]) ok[j][B[i]] = false;
      }
    }
    if (A[i]!=-1&&B[i]!=-1) rep(j,N*2) { ok[A[i]][j] = false; ok[j][B[i]] = false; }
  }
  rep(i,N) if (A[i]!=-1&&B[i]!=-1) ok[A[i]][B[i]] = true;
  // rep(i,N*2) debug(ok[i],ok[i]+N*2);

  bool dp[N+1] = {}; dp[0] = true;
  rep(i,N) {
    if (!dp[i]) continue;
    repr(j,i+1,N+1) {
      bool now = true;
      rep(k,j-i) now &= ok[i*2+k][i*2+k+(j-i)];
      dp[j] |= now;
    }
  }
  // debug(dp,dp+(N+1));

  string result = dp[N] ? "Yes" : "No";
  cout << result << endl;
  return 0;
}
//#pragma GCC optimize "trapv"
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define ll long long int
#define fab(a,b,i) for(ll i=a;i<b;i++)
#define pb push_back
#define db long double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define vll vector<ll>
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;

ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll power(ll x, ll y) {ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, MOD - 2);}
ll lcm(ll x, ll y) { ll res = x / __gcd(x, y); return (res * y);}

db x, y, r;

bool dist(db a, db b)
{
	db dis = (x - a) * (x - a) + (b - y) * (b - y);

	return (dis <= (r * r));
}

int main()
{	quick;
#ifndef ONLINE_JUDGE
	freopen("D:/sublime/input.txt", "r", stdin);
	freopen("D:/sublime/output.txt", "w", stdout);
#endif
	// int T = 1;
	// cin >> T;
	// while (T--)
	{
		cin >> x >> y >> r;

		r += 1e-14;

		ll val = x - r - 400;
		ll op = x + r + 400;
		ll ans = 0;
		fab(val, op + 1, i)
		{
			//cout << "i:" << i << endl;
			ll l = 0, h = 1e10;
			ll op = 0;

			while (l <= h)
			{
				ll mid = (l + h) / 2;
				//cout << "mid:" << mid << endl;

				db coord = floor(y + mid);
				//cout << "coord:" << i << " " << coord << endl;
				if (dist(i, coord))
				{
					//cout << "have:" << i << " " << coord << endl;
					//cout << "mid:" << mid << endl;
					l = mid + 1;
					op = coord - ceil(y) + 1;


				}
				else
					h = mid - 1;
			}
			//cout << "jL" << l << endl;

			ans += op;

			l = (y == int(y) ? 1 : 0), h = 1e10;
			op = 0;
			while (l <= h)
			{
				ll mid = (l + h) / 2;
				//cout << "mid:" << mid << endl;

				db coord = floor(y - mid * 1.0);
				//cout << "coord:" << i << " " << coord << endl;
				if (dist(i, coord))
				{
					//cout << "have1:" << i << " " << coord << endl;
					//cout << "mid1:" << floor(y) - coord + 1 << endl;
					l = mid + 1;
					op = floor(y) - coord + (y == int(y) ? 0 : 1);


				}
				else
					h = mid - 1;
			}
			//cout << "jL2" << l << endl;

			ans += op  ;


		}
		cout << ans << endl;

	}

	cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
	return 0;
}