// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
#define int long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 1000005
#define inf 0x3f3f3f3f
int n,x[maxn],t[maxn];
int can[maxn],pre[maxn],pos[maxn];
int fir[maxn];
int f[maxn],g[maxn];
int dis(int i,int j){return abs(x[i]-x[j]);}
unordered_map<int,int>tmp;
signed main()
{
n=read();
For(i,1,n)t[i]=read(),x[i]=read(),f[i]=g[i]=inf;
For(i,1,n){
can[i]=can[i-1]+(t[i-1]+dis(i,i-1)>t[i]);
pre[i]=i;
if(i>1 && x[i-1]==x[i])pre[i]=pre[i-1];
}
memset(fir,-1,sizeof fir);
For(i,0,n)
if(fir[can[i]]==-1) fir[can[i]]=i;
f[0]=g[0]=0;
pos[0]=0;
For(i,1,n)pos[i]=max(0ll,pre[i]-1);
/*
put clone at x[i],get [0,pos[i]]
f[i] : self take pos[i]
g[i] : clone take pos[i]
*/
For(i,1,n){
For(j,fir[can[i-1]]-1,i-2)
if(1){
if(x[i]!=x[j]){
int tim=max(t[j],max(f[j]+dis(i,j),t[pos[j]]+dis(pos[j],i)));
if(tim+dis(i,j+1)<=t[j+1]) f[i]=min(f[i],tim);
tim=max(t[j],g[j]+dis(i,j));
if(tim+dis(i,j+1)<=t[j+1]) f[i]=min(f[i],tim);
}
if(f[i]<inf)break;
}
if(mp.count(x[i])) f[i]=min(f[i],tmp[x[i]]);
if(x[i-1]==x[i]){
f[i]=min(f[i],f[i-1]);
g[i]=min(g[i],g[i-1]);
}else{
g[i]=min(g[i],max(t[i-1],g[i-1]+dis(i-1,i)));
g[i]=min(g[i],max(max(t[i-1],t[pos[i-1]]+dis(pos[i-1],i)),f[i-1]+dis(i-1,i)));
}
if(f[i]>t[i])f[i]=inf;
if(g[i]>t[i])g[i]=inf;
if(i!=n){
int j=i;
if(g[j]+dis(j,j+1)<=t[j+1]) tmp[x[i]]=min(tmp[x[i]],g[i]);
if(max(f[j]+dis(j,j+1),t[pos[j]]+dis(pos[j],j+1))<=t[j+1]) tmp[x[i]]=min(tmp[x[i]],f[i]);
}
// cout<<f[i]<<" "<<g[i]<<"\n";
}
if(min(f[n],g[n])<inf)puts("YES");
else puts("NO");
return 0;
}
/*
11
1 1
2 1
3 1
4 -2
6 -2
6 1
8 1
11 5
11 1
13 5
14 2
*/