//There are no beautiful surface without a terrible depth
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
 
ll a[1002],b[1002];
int main(){
      ll n,m,t,f=0,charge=0;
      cin>>n>>m>>t;

      charge=n;
      forn(i,m){
            cin>>a[i]>>b[i];
      }
      charge-=(a[0]);
      forn(i,m){
            if(charge<=0){
                  f=1;
                  break;
            }
            charge+=(b[i]-a[i]);
            charge=min(charge,n);
            if(i!=m-1) charge-=(a[i+1]-b[i]);
            else charge-=(t-b[i]);
            if(charge<=0){
                  f=1;
                  break;
            }
            //cout<<charge<<" ";
      }
      if(f==0)cout<<"Yes";
      else cout<<"No";
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define n_l '\n'
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define forn(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef double db;
typedef vector<vi> vvi;
const ll mod=1000000007;
const ll N=200005; //check this
int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};

ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll powb(ll a,ll b) {ll res=1;a ; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a;a=a*a;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

bool cmp(pair<ll,ll> a, pair<ll,ll> b){
	return (a.fi)*2 + a.se > (b.fi)*2 + b.se;

}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int t=1;
    // cin>>t;
    while(t--){
    	int n;cin >> n;
    	vector<pair<ll,ll>> a(n);
    	forn(i,n)cin >> a[i].fi >> a[i].se;
    	sort(all(a),cmp);
    	vector<ll> suf(n+2,0);
    	for(int i = n-1;i>=0;i--){
    		suf[i] = suf[i+1] + a[i].fi;
    	}
    	int ans = n;
    	ll sum = 0;
    	for(int i = 0;i < n; i++){
    		sum += a[i].fi + a[i].se;
    		if(sum > suf[i+1]){
    			ans = i + 1;
    			break;
    		}
    	}
    	cout << ans;
    }
}