#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma")
 
#define f(i,a,b) for(ll  i = a; i < (ll) b ; i++ ) 
#define af(i,a,b) for(ll i = a; i >= (ll) b ; i--)
#define rep(i,a,b,k) for(ll  i = a; i < (ll) b ; i+= k )
#define arep(i,a,b,k) for(ll i = a; i >= (ll) b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define sz(a) (ll) a.size()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller   ios::sync_with_stdio(false);cin.tie(0)
 
// policy-based
 
 
 
 
using namespace std;
 
typedef long long ll; // ll or ll
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

const ll MAX = 3e5 + 20;
const ll mod = 1e9 + 7;
const ll inf = 2e9;


int main(){ 
	fastio;
	ll ans = inf,n,a,p,x;
	cin >> n;
	f(i,0,n){
		cin >> a >> p >> x;
		if(x > a) ans = min(ans,p);
	}
	if(ans == inf) ans = -1;
	cout << ans << endl;
	return 0;
}

// include
#include <algorithm>
#include <complex>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

//型短縮
#define ll long long

//マクロ定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N, M, T;
  cin >> N >> M >> T;
  int originN = N;
  int A = 0, B = 0;
  bool flag = true;
  rep(i, M) {
    int newA;
    int newB;
    cin >> newA >> newB;

    N -= int((newA - B) + 0.5);
    if (N <= 0) {
      flag = false;
      break;
    }

    N += int((newB - newA) + 0.5);
    if (N > originN) N = originN;

    A = newA;
    B = newB;
  }

  N -= int((T - B) + 0.5);
  if (N <= 0) flag = false;

  if (flag)
    cout << "Yes";
  else
    cout << "No";
}