import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			int n = sc.nextInt();
			long[] a = new long[n];
			long[] b = new long[n];
			HashMap<Long,Long> m = new HashMap<Long,Long>();

			for(int i=0;i<n;i++) {
				a[i] = sc.nextLong();
				b[i] = sc.nextLong();
			}

			for(int i=0;i<n;i++) {
				m.merge(b[i], a[i], Long::sum);
			}

			for(Map.Entry<Long, Long> e :m.entrySet()) {
				if(e.getKey()<e.getValue()) {
					System.out.println("No");
					return;
				}
			}

			System.out.println("Yes");
	    }

	}


import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      int N = nextInt();
      Node[] list = new Node[N];
      for(int i = 0; i < N; i++){
        Arraylist<Integer> tmp = nextIntArray();
        list[i] = new Node(tmp.get(0), tmp.get(1));
      }
      Arrays.sort(list, new originComparator());
      int sum = 0;
      for(int i = 0; i < N; i++){
        if(sum + list[i].A <= list[i].B){
          sum += list[i].A;
        }else{
          myout("No");
          return;
        }
      }
      myout("Yes");
	}
	//Method addition frame start

static class Node{
  int A;
  int B;
  Node(int a, int b){
  	A = a;
    B = b;
  }
}

static class originComparator implements Comparator<Node>{
  public int compare(Node mae, Node ato){
    return mae.B - ato.B;
  }
}

	//Method addition frame end
}


//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

void pakuripair_sort(int N, int A[], int B[]) {
	const int b = 8;
	int tmp[200001], tmp2[200001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) {
			tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
			tmp2[kazu[A[i] >> k * b & ((1 << b) - 1)]] = B[i];
		}
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) {
			A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
			B[kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp2[i];
		}
	}
}

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);

	int N = getint();
	int A[200000], B[200000];
	rep(i, N) {
		A[i] = getint();
		B[i] = getint();
	}
	pakuripair_sort(N, B, A);

	ll time = 0;
	bool OK = true;
	rep(i, N) {
		time += A[i];
		if (time > B[i]) OK = false;
	}

	if (OK) printf("Yes");
	else printf("No");

	Would you please return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N = getint();
	pair<int, int> P[200000];
	rep(i, N) {
		int a = getint(), b = getint();
		P[i] = mp(b, a);
	}
	sort(P, P + N);

	ll time = 0;
	bool OK = true;
	rep(i, N) {
		time += P[i].second;
		if (time > P[i].first) OK = false;
	}

	if (OK) co("Yes");
	else co("No");

	Would you please return 0;
}


#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;

	char buf[L], *S , *T, c;

	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}

	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}

	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	char B[45], *outs=B+40, *outr=B+40;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;

		if(!a)*--outs = '0';
		else
			while(a)
				*--outs = (a % 10) + 48, a /= 10;

		if(x)
			*--outs = x;

		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
//using i128 = __int128_t;
//using u128 = __uint128_t;
using i128 = i64;
using u128 = u64;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

ll exgcd(ll a, ll b, ll &x, ll &y)
{
	if (b == 0)
	{
		x = 1;
		y = 0;
		return a;
	}
	ll px, py;
	ll d = exgcd(b, a%b, px, py);
	x = py;
	y = px-a/b*py;
	return d;
}

template<class T>
inline void freshmin(T &a, const T &b)
{
	if (a > b) a = b;
}

template<class T>
inline void freshmax(T &a, const T &b)
{
	if (a < b) a = b;
}

const int MOD = 1000000007;
const int INF = 1000000000;
const int MAXN = 200010;

int n;
pll v[MAXN];

int main()
{

	n = inp();
	for (int i = 1; i <= n; ++ i)
	{
		ll x = inp();
		ll y = inp();
		v[i] = pll(y, x);
	}
	sort(v+1, v+n+1);
	ll cur = 0;
	for (int i = 1; i <= n; ++ i)
	{
		cur += v[i].Y;
		if (cur > v[i].X)
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
    ll n;
    cin>>n;
    ll sum =0;
    ll  maxB = INT_MIN;
    for(int i=0;i<n;i++)
    {
        ll a , b;
        cin>>a>>b;
        sum += a;
        maxB = max( maxB , b);
    }
    if( sum <= maxB )
    {
        cout<<"Yes";
    }
    else cout<<"No";
}


/*
"Won't stop until I'm phenomenal."
- Phenomenal, Eminem
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;

int main(){
    Shazam;
    int n; cin>>n;
    vector<pair<int,int>> a(n);
    for(int i = 0 ; i < n; i++)
        cin>>a[i].ss>>a[i].ff;
    sort(all(a));
    int t = 0;
    bool can = true;
    for(int i = 0 ; i < n; i++){
        if(a[i].ff<t){
            can = false;
            break;
        }
        t += a[i].ss;
    }
    cout<<((can)?"Yes":"No")<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll llINF=1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);

int main() {
  ll n;
  cin>>n;
  vi a(n),b(n);
  ll sum=0;
  rep(i,n){
    cin>>a[i]>>b[i];
    sum+=a[i];
  }
  sort(all(a)); sort(all(b));
  reverse(all(a)); reverse(all(b));
  rep(i,n){
    if(b[i]<sum){
      cout<<"No"<<endl;
      return 0;
    }
    sum-=a[i];
  }
  cout<<"Yes"<<endl;
}


// AtCoder ABC131: D - Megalomania
// 2019.9.4 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

typedef struct { int a, b; } T;
T t[200005]; int N;

void Qsort(T *a, int l, int r) {
	int i, j, m; T t;

	i = l, j = r, m = a[(l+r) >> 1].b;
	while (1) {
		while (a[i].b < m) i++;
		while (m < a[j].b) j--;
		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

int main()
{
	int i, s;

	N = in(); for (i = 0; i < N; i++) {
		t[i].a = in(), t[i].b = in();
		if (t[i].a > t[i].b) goto No;
	}
	Qsort(t, 0, N-1);
	s = 0; for (i = 0; i < N; i++) {
		s += t[i].a;
		if (s > t[i].b) goto No;
	}
	puts("Yes"); return 0;
No: puts("No");  return 0;
}


// AtCoder ABC131: D - Megalomania
// 2019.9.4 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

typedef struct { int a, b; } T;
T t[200005]; int N;

void Qsort(T *a, int l, int r) {
	int i, j, m; T t;

	i = l, j = r, m = a[(l+r) >> 1].b;
	while (1) {
		while (a[i].b < m) i++;
		while (m < a[j].b) j--;
		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

int main()
{
	int i, s;

	N = in(); for (i = 0; i < N; i++) t[i].a = in(), t[i].b = in();
	Qsort(t, 0, N-1);
	s = 0; for (i = 0; i < N; i++) {
		s += t[i].a;
		if (s > t[i].b) goto No;
	}
	puts("Yes"); return 0;
No: puts("No");  return 0;
}


// AtCoder ABC131: D - Megalomania
// 2019.9.4 bal4u

#include <stdio.h>

typedef long long ll;

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

ll t[200005]; int N;

void Qsort(ll *a, int l, int r) {
	int i, j; ll m, t;

	i = l, j = r, m = a[(l+r) >> 1];
	while (1) {
		while (a[i] < m) i++;
		while (m < a[j]) j--;
		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

int main()
{
	int i, a, b; ll s;

	N = in(); for (i = 0; i < N; i++) {
		a = in(), b = in();
		t[i] = ((ll)b << 32) | a;
	}
	Qsort(t, 0, N-1);
	s = 0; for (i = 0; i < N; i++) {
		s += t[i] & 0xffffffff;
		if (s > (t[i] >> 32)) goto No;
	}
	puts("Yes"); return 0;
No: puts("No");  return 0;
}


#include "bits/stdc++.h"
using namespace std;
int main(){
    int N,time;
    bool res=true;
    cin >>N;
    vector<pair<int,int>> task(N);
    for(int i=0;i<N;i++){
        int a,b;
        cin>>a>>b;
        pair<int,int> t(b,a);
        task[i]=t;
    }
    sort(task.begin(),task.end());
    for(int i=0;i<N;i++){
      	time+=task[i].second;
      	//cout<<task[i].second<<" "<<task[i].first<<endl;
        if(time>task[i+1].first){
            res=false;
            break;
        }
    }
    if(res) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


#include <bits/stdc++.h>

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int n;
	cin >> n;
	vector<P> a(n);
	rep(i,n) cin >> a[i].second >> a[i].first; // 締切,所要時間
	SORT(a);
	int time = 0;
	rep(i,n){
		if(time + a[i].second <= a[i].first){
			// 間に合う
			time += a[i].second;
		} else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}


#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;

typedef long long ll;
const ll MOD = 1e9+7;
const ll INF = 1e18;

#define PB push_back
#define MP make_pair
#define F first
#define S second

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}
bool compare_by_second(pair<ll,ll> a,pair<ll,ll> b){
    if(a.S != b.S){
        return a.S < b.S;
    }else{
        return a.F < b.F;
    }
}

vector<pair<ll,ll>> task;

int main(){
    ll n;
    cin >> n;
    for(ll i=0;i<n;i++){
        ll tmp,tmp2;
        cin >> tmp >> tmp2;
        task.PB(MP(tmp,tmp2));
    }

    sort(task.begin(),task.end(),compare_by_second);
    ll sum=0;
    for(auto &e: task){
        sum+=e.F;
        if(sum>e.S){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


function Main(input) {
    input = input.trim().split("\n");
    var tmp = input[0].split(" ");
    var N = parseInt(tmp[0], 10);
    var AB = [];
    for (var i = 1; i < N + 1; i++){
        tmp = input[i].split(" ");
        AB[i-1] = {A:parseInt(tmp[0],10),B:parseInt(tmp[1],10)}
    }
    AB.sort(function (a, b) {
        if (a.B < b.B) return -1;
        if (a.B > b.B) return 1;
        return 0;
    });
    var time = 0;
    var judge = "Yes";
    for (var i = 0; i < N; i++){
        time += AB[i].A;
        if (time > AB[i].B) {
            judge = "No";
            break;
        }
    }
    console.log(judge);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=new Array(e),n=0;n<e;n++){var i=t.in(),o=t.in();r[n]={a:i,b:o}}r.sort(function(t,e){return t.b-e.b});for(var s=0,u=0;u<e;u++)if((s+=r[u].a)>r[u].b)return void console.log("No");console.log("Yes")}}]);


var natural={};

natural.successor=function(a){
    var ret=a.split(' ');
    for(var i=ret.length-1;i>=0;i--){
        if(ret[i]==='9'){
            ret[i]=0;
        }else{
            ret[i]=(ret[i]-0)+1+'';
            break;
        }
        if(i===0){
            ret.unshift('1');
        }
    }
    return ret.join('');
}

natural.add=function(...nums){//あまりにも多いnumsは扱えません
    var array=[];
    var max=0;
    nums.forEach(e=>{
        if(max<e.length){
            max=e.length;
        }
    });
    nums.forEach(e=>{
        array.push('0'.repeat(max-e.length)+e);
    });
    var temp;
    var ret='';
    var c=0;//繰り上がり
    for(var i=max-1;i>=0;i--){
        temp=c;
        array.forEach(e=>{
            temp+=(e[i]-0);
        });
        c=Math.floor(temp/10);
        ret=(temp%10)+ret;
    }
    return (c===0?'':c)+ret;
}

natural.subtract=function(a,b){
    if(this.isFormerLarger(b,a)){
        return false;
    }
    var l=b.length;
    var inversedB=b.split('').map(e=>{
        return 9-e;
    }).join('');
    while(inversedB[0]==='0'){
        inversedB=inversedB.slice(1);
    }
    var ret=natural.add(a,inversedB,'1').split('');
    for(var i=ret.length-l-1;i>=0;i--){
        if(ret[i]==='0'){
            ret[i]='9';
        }else{
            ret[i]=(ret[i]-1)+'';
            break;
        }
    }
    while(ret[0]==='0'){
        ret.shift();
    }
    return ret.join('')||'0';
}

natural.isFormerLarger=function(a,b){
    if(a.length>b.length){
        return true;
    }else if(a.length<b.length){
        return false;
    }
    for(var i=0;i<a.length;i++){
        if(a[i]>b[i]){
            return true;
        }else if(a[i]<b[i]){
            return false;
        }
    }
    return false;
}

natural.product=function(...nums){//あまりにも多いnumsは扱えません
    if(nums.some(e=>{return e==='0';})){
        return '0';
    }
    var pointer=new Array(nums.length);
    pointer.fill(0);
    var zeros=0;
    var array=[];
    var str;
    loop1:
    while(true){
        str=1;
        for(var i=0;i<nums.length;i++){
            str*=nums[i][nums[i].length-1-pointer[i]];
        }
        if(str!==0){
            str+='0'.repeat(zeros);
            array.push(str);
        }
        for(var i=0;i<pointer.length;i++){
            if(pointer[i]===nums[i].length-1){
                pointer[i]=0;
                zeros-=nums[i].length-1;
            }else{
                pointer[i]++;
                zeros++;
                break;
            }
            if(i===pointer.length-1){
                break loop1;
            }
        }
    }
    return natural.add(...array);
}

natural.divide=function(a,b){
    if(b==='0'){
        return false;
    }
    if(this.isFormerLarger(b,a)){
        return '0';
    }
    var workbench='';
    var vault=a+'';
    var ret='';
    do{
        workbench+=vault[0];
        vault=vault.slice(1);
        if(workbench==='0'){
            ret+='0';
            workbench='';
            continue;
        }
        for(var i=1;i<=10;i++){
            if(natural.isFormerLarger(natural.product(b,i+''),workbench)){
                if(i>1){
                    workbench=natural.subtract(workbench,natural.product((i-1)+'',b));
                }
                ret+=(i-1)+'';
                break;
            }else if(natural.product(b,i+'')===workbench){
                workbench='';
                ret+=i+'';
                break;
            }
        }
    }while(vault.length>0)
    while(ret[0]==='0'){
        ret=ret.slice(1);
    }
    return ret;
}

natural.mod=function(a,b){
    if(b==='0'){
        return false;
    }
    return natural.subtract(a,natural.product(b,natural.divide(a,b)));
}

natural.factorial=function(a){
    var ret='1';
    for(var i=2;i<=a;i++){
        ret=natural.product(ret,i+'');
    }
    return ret;
}

natural.power=function(a,b){
    if(a==='0'&&b==='0'){
        return false;
    }
    if(a==='0'){
        return '0';
    }
    if(b==='0'){
        return '1';
    }
    var array=[];
    var next;
    var flg;
    while(b!=='0'.repeat(b.length)){
        next=''
        flg=0;
        for(var i=0;i<b.length;i++){
            next+=Math.floor(b[i]/2)+flg;
            flg=(b[i]%2)*5;
        }
        array.push(flg===5);
        b=next;
    }
    var memo=[a];
    for(var i=1;i<array.length;i++){
        memo.push(natural.product(memo[memo.length-1],memo[memo.length-1]));
    }
    var elem=memo.filter((e,i)=>{
        return array[i];
    });
    return natural.product(...elem);
}

natural.lcm=function(...nums){
    var temp=nums[0];
    var a,b;
    for(var i=1;i<nums.length;i++){
        a=temp;
        b=nums[i];
        while(true){
            a=natural.mod(a,b);
            if(a==='0'){
                temp=natural.divide(natural.product(temp,nums[i]),b);
                break;
            }
            b=natural.mod(b,a);
            if(b==='0'){
                temp=natural.divide(natural.product(temp,nums[i]),a);
                break;
            }
        }
    }
    return temp;
}

var rational={};

rational.add=function(...nums){

}

function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const N=input[0].split(' ')[0];
  const tasks=input.slice(1).map(e=>{
    return e.split(' ').map(f=>{
      return f-0;
    });
  }).sort((a,b)=>{
    return a[1]-b[1];
  });
  //console.log(tasks);
  var flg='Yes';
  var cur=0;
  tasks.forEach(e=>{
    cur+=e[0];
    if(cur>e[1]){
      flg='No';
    }
  });
  console.log(flg);

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


const input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");

const N = input[0].split(' ').map(item => parseInt(item))[0]
input.shift()
input.pop()

AB = input.map(item => item.split(' ').map(item2 => parseInt(item2)))
const A = AB.map(item => item[0])
const B = AB.map(item => item[1])

// console.log(AB)
AB.sort((a, b) => a[1] - b[1])
// console.log(AB)

count = 0
for (let i = 0; i < N; i++) {
    count += AB[i][0]
    if (count > AB[i][1]) {
        console.log('No')
        return
    }
}
console.log('Yes')


const input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");

const N = input[0].split(' ').map(item => parseInt(item))[0]
input.shift()
input.pop()

AB = input.map(item => item.split(' ').map(item2 => parseInt(item2)))
const A = AB.map(item => item[0])
const B = AB.map(item => item[1])

// console.log(AB)
AB = AB.sort((a, b) => a[1] - b[1])
// console.log(AB)

count = 0
for (let i = 0; i < N; i++) {
    count += AB[i][0]
    if (count > AB[i][1]) {
        console.log('No')
        return
    }
}
console.log('Yes')


const input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");

const N = input[0].split(' ').map(item => parseInt(item))[0]
input.shift()
input.pop()

const AB = input.map(item => item.split(' ').map(item2 => parseInt(item2)))
const A = AB.map(item => item[0])
const B = AB.map(item => item[1])

count = 0
for (i = 0; i < N; i++) {
    min_index = 0
    // console.log(AB)
    AB.reduce((prev, current, index) => {
        // console.log(prev, current, index, min_index)
        if (prev[1] <= current[1]) {
            return prev
        } else {
            min_index = index
            return current
        }
    })
    count += AB[min_index][0]
    if (count > AB[min_index][1]) {
        console.log('No')
        return
    }
    AB.splice(min_index, 1)
}

console.log('Yes')


package main

import (
	"bufio"
	"fmt"
	"io"
	"math/rand"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	n := readi()
	a := make([]int, n)
	b := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readi()
		b[i] = readi()
	}
	quicksort(b, a)

	total := 0
	for i := 0; i < n; i++ {
		total = total + a[i]
		if total > b[i] {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

func quicksort(x, y []int) {
	if len(x) < 2 {
		return
	}

	left, right := 0, len(x)-1
	pivot := rand.Int() % len(x)

	x[pivot], x[right] = x[right], x[pivot]
	y[pivot], y[right] = y[right], y[pivot]

	for i, _ := range x {
		if x[i] < x[right] {
			x[left], x[i] = x[i], x[left]
			y[left], y[i] = y[i], y[left]
			left++
		}
	}

	x[left], x[right] = x[right], x[left]
	y[left], y[right] = y[right], y[left]

	quicksort(x[:left], y[:left])
	quicksort(x[left+1:], y[left+1:])

	return
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

// func chmin(x *int, y int) bool {
// 	if *x > y {
// 		*x = y
// 		return true
// 	}
// 	return false
// }

// func chmax(x *int, y int) bool {
// 	if *x < y {
// 		*x = y
// 		return true
// 	}
// 	return false
// }

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}

func isPrime(n int) bool {
	if n == 1 {
		return false
	}
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func primeFactors(n int) []int {
	factors := make([]int, 0)
	i := 2
	for i*i <= n {
		r := n % i
		if r != 0 {
			i++
		} else if r == 0 {
			n /= i
			factors = append(factors, i)
		}
	}
	if n > 1 {
		factors = append(factors, n)
	}
	return factors
}

func divisor(n int) (res []int) {
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i*i != n {
				res = append(res, n/i)
			}
		}
	}
	sort.Ints(res)
	return
}

func searchInts(a []int, k int) int {
	return binarySearch(len(a), func(i int) bool {
		return a[i] >= k
	})
}

func binarySearch(n int, f func(int) bool) int {
	i, j := 0, n
	for i < j {
		h := int(uint(i+j) >> 1)
		if !f(h) {
			i = h + 1
		} else {
			j = h
		}
	}
	return i
}

func reverseStr(s string) string {
	var b strings.Builder
	b.Grow(len(s))
	for i := len(s) - 1; i >= 0; i-- {
		b.WriteByte(s[i])
	}
	return b.String()
}

type Queue struct {
	items []int
}

func (q *Queue) push(item int) {
	q.items = append(q.items, item)
}

func (q *Queue) pop() {
	q.items = q.items[1:]
}

func (q *Queue) front() int {
	return q.items[0]
}

func (q *Queue) size() int {
	return len(q.items)
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"math/rand"
	"os"
	"sort"
	"strconv"
	"strings"
)

var (
	a []int
	b []int
)

func main() {
	n := readi()
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readi()
		b[i] = readi()
	}
	quicksort(b, a)

	total := 0
	for i := 0; i < n; i++ {
		total = total + a[i]
		if total > b[i] {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

func quicksort(x, y []int) {
	if len(x) < 2 {
		return
	}

	left, right := 0, len(x)-1
	pivot := rand.Int() % len(x)

	x[pivot], x[right] = x[right], x[pivot]
	y[pivot], y[right] = y[right], y[pivot]

	for i, _ := range x {
		if x[i] < x[right] {
			x[left], x[i] = x[i], x[left]
			y[left], y[i] = y[i], y[left]
			left++
		}
	}

	x[left], x[right] = x[right], x[left]
	y[left], y[right] = y[right], y[left]

	quicksort(x[:left], y[:left])
	quicksort(x[left+1:], y[left+1:])

	return
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

// func chmin(x *int, y int) bool {
// 	if *x > y {
// 		*x = y
// 		return true
// 	}
// 	return false
// }

// func chmax(x *int, y int) bool {
// 	if *x < y {
// 		*x = y
// 		return true
// 	}
// 	return false
// }

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}

func isPrime(n int) bool {
	if n == 1 {
		return false
	}
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func primeFactors(n int) []int {
	factors := make([]int, 0)
	i := 2
	for i*i <= n {
		r := n % i
		if r != 0 {
			i++
		} else if r == 0 {
			n /= i
			factors = append(factors, i)
		}
	}
	if n > 1 {
		factors = append(factors, n)
	}
	return factors
}

func divisor(n int) (res []int) {
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i*i != n {
				res = append(res, n/i)
			}
		}
	}
	sort.Ints(res)
	return
}

func searchInts(a []int, k int) int {
	return binarySearch(len(a), func(i int) bool {
		return a[i] >= k
	})
}

func binarySearch(n int, f func(int) bool) int {
	i, j := 0, n
	for i < j {
		h := int(uint(i+j) >> 1)
		if !f(h) {
			i = h + 1
		} else {
			j = h
		}
	}
	return i
}

func reverseStr(s string) string {
	var b strings.Builder
	b.Grow(len(s))
	for i := len(s) - 1; i >= 0; i-- {
		b.WriteByte(s[i])
	}
	return b.String()
}

type Queue struct {
	items []int
}

func (q *Queue) push(item int) {
	q.items = append(q.items, item)
}

func (q *Queue) pop() {
	q.items = q.items[1:]
}

func (q *Queue) front() int {
	return q.items[0]
}

func (q *Queue) size() int {
	return len(q.items)
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	if resolve(parseProblem()) {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func parseProblem() (int, []task) {
	n := scanInt(sc)
	result := make([]task, n)
	for i := 0; i < n; i++ {
		result[i] = task{
			take:  scanInt(sc),
			limit: scanInt(sc),
		}
	}
	return n, result
}

type task struct{ take, limit int }
type tasks []task

func (t tasks) Len() int {
	return len(t)
}

func (t tasks) Less(i, j int) bool {
	return t[i].limit < t[j].limit
}

func (t tasks) Swap(i, j int) {
	t[i], t[j] = t[j], t[i]
}

func resolve(n int, ts []task) bool {
	sort.Sort(tasks(ts))
	sum := 0
	for _, t := range ts {
		sum += t.take
		if t.limit < sum {
			return false
		}
	}
	return true
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var DEBUG = true

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO functions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbufferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbufferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func debugf(f string, args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintf(os.Stderr, f, args...)
}

func debug(args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()
	n := readi()
	t := make([]task, n)
	for i := 0; i < n; i++ {
		t[i] = task{readi(), readi()}
	}

	answer := solve(n, t)
	if answer <= 0 {
		println("Yes")
	} else {
		println("No")
	}
}

type task struct {
	a, b int
}

type ByEnd []task

func (a ByEnd) Len() int           { return len(a) }
func (a ByEnd) Less(i, j int) bool { return a[i].b < a[j].b }
func (a ByEnd) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func solve(n int, t []task) int {
	DEBUG = false
	sort.Sort(ByEnd(t))
	pile := 0
	tIndex := len(t) - 1
	for i := t[tIndex].b; i > 0; {
		nextIDiff := 1
		for tIndex >= 0 && t[tIndex].b == i {
			pile += t[tIndex].a
			tIndex--
			if tIndex >= 0 {
				nextIDiff = t[tIndex].b
			} else {
				nextIDiff = i
			}

		}

		if pile > 0 {
			pile -= nextIDiff
		}
		i = i - nextIDiff
	}
	// debug(pile)
	return pile
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var DEBUG = true

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO functions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbufferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbufferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func debugf(f string, args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintf(os.Stderr, f, args...)
}

func debug(args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()
	n := readi()
	t := make([]task, n)
	for i := 0; i < n; i++ {
		t[i] = task{readi(), readi()}
	}

	answer := solve(n, t)
	if answer <= 0 {
		println("Yes")
	} else {
		println("No")
	}
}

type task struct {
	a, b int
}

type ByEnd []task

func (a ByEnd) Len() int           { return len(a) }
func (a ByEnd) Less(i, j int) bool { return a[i].b < a[j].b }
func (a ByEnd) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func solve(n int, t []task) int {
	DEBUG = false
	sort.Sort(ByEnd(t))
	pile := 0
	tIndex := len(t) - 1
	for i := t[tIndex].b; i > 0; {
		nextIDiff := 1
		for tIndex >= 0 && t[tIndex].b == i {
			pile += t[tIndex].a
			tIndex--
			if tIndex >= 0 {
				nextIDiff = t[tIndex].b
			} else {
				break
			}

		}

		if pile > 0 {
			pile -= nextIDiff
		}
		i = i - nextIDiff
	}
	// debug(pile)
	return pile
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var DEBUG = true

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO functions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbufferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbufferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func debugf(f string, args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintf(os.Stderr, f, args...)
}

func debug(args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()
	n := readi()
	t := make([]task, n)
	maxB := 0
	for i := 0; i < n; i++ {
		t[i] = task{readi(), readi()}
		maxB = max(maxB, t[i].b)
	}

	answer := solve(n, t, maxB)
	if answer <= 0 {
		println("Yes")
	} else {
		println("No")
	}
}

type task struct {
	a, b int
}

type ByEnd []task

func (a ByEnd) Len() int           { return len(a) }
func (a ByEnd) Less(i, j int) bool { return a[i].b < a[j].b }
func (a ByEnd) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func solve(n int, t []task, maxB int) int {
	DEBUG = false
	sort.Sort(ByEnd(t))
	pile := 0
	tIndex := len(t) - 1
	for i := maxB; i > 0; i-- {
		debug("maxB", maxB)
		for tIndex >= 0 && t[tIndex].b == i {
			pile += t[tIndex].a
			debug("pile", pile)
			tIndex--
		}

		if pile > 0 {
			pile--
		}
	}
	// debug(pile)
	return pile
}


sa = 0
puts gets.to_i.times.map{
	gets.split.map(&:to_i)
}.sort_by{|_,b| b }.all?{|a,b|
	sa += a
	sa <= b
}?'Yes':'No'


n=gets.to_i
all=[]
n.times.each do
    v=gets.split.map(&:to_i)
    all<<v

end
all=all.sort_by{|_,v|v}
count=0
for i in 0..all.length-1
    count+=all[i][0]
    if count<=all[i][1]
        next
    else
        puts "No"
        exit

    end
end
puts "Yes"


n = gets.to_i
a = Array.new(n){gets.split.map(&:to_i)}.sort_by{|x, y| y}
sum = 0
a.each do |x, y|
  sum += x
  if sum > y
    puts 'No'
    exit
  end
end
puts 'Yes'


n = gets.to_i
tasks = []
n.times do
  a, b = gets.split.map(&:to_i).sort
  tasks << [b,a]
end
now = 0
tasks.sort.each do |t|
  now += t[1]
  if now > t[0]
    puts 'No'
    exit
  end
end
puts 'Yes'


n=gets.to_i
j=[]
n.times do
  a,b=gets.split.map(&:to_i)
  j << [a,b]
end
j.sort!{|j1,j2|j1[1]<=>j2[1]}
sum=0
for i in 0...n do
  sum+=j[i][0]
  if sum>j[i][1]
    puts "No"
    return
  end
end
puts"Yes"


inputs=$stdin.read.split("\n")
ab =inputs[1..-1].map{|x| x.split(/\s/).map(&:to_i)}
sum=0
ab.sort! {|x,y| x[1]==y[1] ? x[0] <=>y[0] : x[1] <=> y[1] }
ab.each do |(a,b)|
 sum+=a
 if sum > b
   puts "No"
   return
 end
end


use std::io::*;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

pub fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let n = i.read::<usize>();
    let ab = i.read_vec::<(usize, usize)>(n);
    let ans = if solve(ab) { "Yes" } else { "No" };
    writeln!(o, "{}", ans).unwrap();
}
fn solve(mut ab: Vec<(usize, usize)>) -> bool {
    ab.sort_by_key(|&(_a, b)| b);

    let mut t = 0;
    for (a, b) in ab {
        t += a;
        if t > b {
            return false;
        }
    }
    true
}

pub mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        b: Vec<u8>,
    }
    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                b: Vec::new(),
            }
        }
        pub fn read_word(&mut self) -> &[u8] {
            self.b.clear();
            let mut consume = 0;
            loop {
                self.r.consume(consume);
                let b = self.r.fill_buf().unwrap();
                assert!(b.len() != 0);
                if let Some(p) = b.iter().position(|&x| x == b' ' || x == b'\n') {
                    self.b.extend_from_slice(&b[..p]);
                    consume = p + 1;
                    break;
                }
                self.b.extend_from_slice(b);
                consume = b.len();
            }
            self.r.consume(consume);
            &self.b
        }
        pub fn read_word_str(&mut self) -> &str {
            unsafe { std::str::from_utf8_unchecked(self.read_word()) }
        }

        pub fn read_line(&mut self) -> &[u8] {
            self.b.clear();
            self.r.read_until(b'\n', &mut self.b).unwrap();
            if self.b.last() == Some(&b'\n') {
                &self.b[..self.b.len() - 1]
            } else {
                &self.b
            }
        }
        pub fn read_line_str(&mut self) -> &str {
            unsafe { std::str::from_utf8_unchecked(self.read_line()) }
        }

        pub fn read<T: CpIn>(&mut self) -> T {
            T::read_from(self)
        }

        pub fn read_vec<T: CpIn>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read()).collect()
        }
        pub fn read_iter<'a, T: CpIn>(&'a mut self, n: usize) -> CpIter<'a, R, T> {
            CpIter {
                r: self,
                n: n,
                _pd: Default::default(),
            }
        }
    }
    pub struct CpIter<'a, R: BufRead + 'a, T> {
        r: &'a mut CpReader<R>,
        n: usize,
        _pd: std::marker::PhantomData<fn() -> T>,
    }
    impl<'a, R: BufRead, T: CpIn> Iterator for CpIter<'a, R, T> {
        type Item = T;
        fn next(&mut self) -> Option<T> {
            if self.n == 0 {
                None
            } else {
                self.n -= 1;
                Some(self.r.read())
            }
        }
    }

    pub trait CpIn {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self;
    }

    impl CpIn for u64 {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
            read_u64_fast(&mut r.r)
        }
    }
    impl CpIn for i64 {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
            read_i64_fast(&mut r.r)
        }
    }
    impl CpIn for char {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
            let b = r.r.fill_buf().unwrap()[0] as char;
            r.r.consume(1);
            let s = r.r.fill_buf().unwrap()[0];
            assert!(s == b' ' || s == b'\n');
            r.r.consume(1);
            b
        }
    }

    macro_rules! cpin_tuple {
        ($($t:ident),*) => {
            impl<$($t: CpIn),*> CpIn for ($($t),*) {
                fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
                    ($($t::read_from(r)),*)
                }
            }
        };
    }

    macro_rules! cpin_cast {
        ($t_self:ty, $t_read:ty) => {
            impl CpIn for $t_self {
                fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
                    <$t_read>::read_from(r) as $t_self
                }
            }
        };
    }
    macro_rules! cpin_parse {
        ($t:ty) => {
            impl CpIn for $t {
                fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
                    r.read_word_str().parse().unwrap()
                }
            }
        };
    }
    cpin_cast!(usize, u64);
    cpin_cast!(u32, u64);
    cpin_cast!(u16, u64);
    cpin_cast!(i32, i64);
    cpin_cast!(i16, i64);
    cpin_cast!(i8, i64);

    cpin_parse!(f64);

    cpin_tuple!(T1, T2);
    cpin_tuple!(T1, T2, T3);
    cpin_tuple!(T1, T2, T3, T4);
    cpin_tuple!(T1, T2, T3, T4, T5);

    fn read_u64_fast<R: BufRead>(r: &mut R) -> u64 {
        let mut value = 0;
        loop {
            let mut idx = 0;
            let buf_len;
            {
                let buf = r.fill_buf().unwrap();
                buf_len = buf.len();
                assert!(buf_len != 0);
                while idx < buf_len && b'0' <= buf[idx] && buf[idx] <= b'9' {
                    value = value * 10 + (buf[idx] - b'0') as u64;
                    idx += 1;
                }
            }
            if idx < buf_len {
                r.consume(idx + 1);
                return value;
            }
            r.consume(idx);
        }
    }
    fn read_i64_fast<R: BufRead>(r: &mut R) -> i64 {
        let (consume, sign) = match r.fill_buf().unwrap()[0] {
            b'+' => (true, 1),
            b'-' => (true, -1),
            _ => (false, 1),
        };
        if consume {
            r.consume(1);
        }
        read_u64_fast(r) as i64 * sign
    }

}


use std::io::*;

const SP: u8 = b' ';
const LF: u8 = b'\n';

struct CharacterInput<'a> {
    locked_stdin: StdinLock<'a>,
    bytes_buffer: Vec<u8>,
}

impl<'a> CharacterInput<'a> {
    fn read(&mut self, delimiter: u8) -> &[u8] {
        self.bytes_buffer.clear();

        let mut len = self
            .locked_stdin
            .read_until(delimiter, &mut self.bytes_buffer)
            .unwrap();

        if len > 0 {
            len -= 1;
        }

        &self.bytes_buffer[0..len]
    }

    fn scan_u(&mut self, delimiter: u8) -> u32 {
        self.read(delimiter)
            .into_iter()
            .fold(0, |accumulator, byte| {
                (byte - b'0') as u32 + accumulator * 10
            })
    }
}

fn create_cin<'a>(input: StdinLock<'a>, buffer_capacity: usize) -> CharacterInput {
    CharacterInput {
        locked_stdin: input,
        bytes_buffer: Vec::with_capacity(buffer_capacity),
    }
}

fn println<T: std::string::ToString>(s: T) {
    println!("{}", s.to_string());
}

// ------------------------------------------------------------------------

#[derive(Copy, Clone)]
struct Task {
    duration: u32,
    limit: u32
}

fn main() {
    let cin = stdin();
    let cin = &mut create_cin(cin.lock(), 64);

    let n = cin.scan_u(LF) as usize;

    let mut tasks: Vec<Task> = (0..n).map(|_| Task { duration: cin.scan_u(SP), limit: cin.scan_u(LF) }).collect();
    tasks.sort_by(|a, b| a.limit.partial_cmp(&b.limit).unwrap());

    let mut accumulated_duration: u32 = 0;

    for task in tasks.into_iter() {
        accumulated_duration += task.duration;
        if accumulated_duration > task.limit {
            println("No");
            return;
        }
    }

    println("Yes");
}


#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
#[macro_export]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut parser = Parser :: from_str ( $ s ) ; input_inner ! { parser , $ ( $ r ) * } } ; ( parser = $ parser : ident , $ ( $ r : tt ) * ) => { input_inner ! { $ parser , $ ( $ r ) * } } ; ( new_stdin_parser = $ parser : ident , $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let reader = std :: io :: BufReader :: new ( stdin . lock ( ) ) ; let mut $ parser = Parser :: new ( reader ) ; input_inner ! { $ parser , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { input ! { new_stdin_parser = parser , $ ( $ r ) * } } ; }
#[macro_export]
macro_rules ! input_inner { ( $ parser : ident ) => { } ; ( $ parser : ident , ) => { } ; ( $ parser : ident , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ parser , $ t ) ; input_inner ! { $ parser $ ( $ r ) * } } ; }
#[macro_export]
macro_rules ! read_value { ( $ parser : ident , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ parser , $ t ) ) ,* ) } ; ( $ parser : ident , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ parser , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ parser : ident , chars ) => { read_value ! ( $ parser , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ parser : ident , usize1 ) => { read_value ! ( $ parser , usize ) - 1 } ; ( $ parser : ident , $ t : ty ) => { $ parser . next ::<$ t > ( ) . expect ( "Parse error" ) } ; }
use std::io;
use std::io::BufRead;
use std::str;
pub struct Parser<R> {
    reader: R,
    buf: Vec<u8>,
    pos: usize,
}
impl Parser<io::Empty> {
    pub fn from_str(s: &str) -> Parser<io::Empty> {
        Parser {
            reader: io::empty(),
            buf: s.as_bytes().to_vec(),
            pos: 0,
        }
    }
}
impl<R: BufRead> Parser<R> {
    pub fn new(reader: R) -> Parser<R> {
        Parser {
            reader: reader,
            buf: vec![],
            pos: 0,
        }
    }
    pub fn update_buf(&mut self) {
        self.buf.clear();
        self.pos = 0;
        loop {
            let (len, complete) = {
                let buf2 = self.reader.fill_buf().unwrap();
                self.buf.extend_from_slice(buf2);
                let len = buf2.len();
                if len == 0 {
                    break;
                }
                (len, buf2[len - 1] <= 0x20)
            };
            self.reader.consume(len);
            if complete {
                break;
            }
        }
    }
    pub fn next<T: str::FromStr>(&mut self) -> Result<T, T::Err> {
        loop {
            let mut begin = self.pos;
            while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                begin += 1;
            }
            let mut end = begin;
            while end < self.buf.len() && (self.buf[end] > 0x20) {
                end += 1;
            }
            if begin != self.buf.len() {
                self.pos = end;
                return str::from_utf8(&self.buf[begin..end]).unwrap().parse::<T>();
            } else {
                self.update_buf();
            }
        }
    }
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    input!{
        N:usize,
        AB:[(i64,i64);N]
    }
    let mut ab=AB;
    ab.sort_by_key(|&x| x.1);
    // dbg!(&ab);
    let mut left=0;
    for i in 0..ab.len() {
        let (a,b)=ab[i];
        let c=b-a;
        // dbg!(c);
        if c<left {
            println!("No");
            return
        }
        left+=a;
    }
    // dbg!(left);
    println!("Yes");
}


#[derive(Default)]
//NOTE
//declare variables to reduce the number of parameters for dp and dfs etc.
struct Solver {}

impl Solver {
    fn solve(&mut self) {
        let stdin = std::io::stdin();
        let mut scn = Scanner {
            stdin: stdin.lock(),
        };
        let n: usize = scn.read();
        let mut ab: Vec<_> = (0..n)
            .map(|_| {
                let a: usize = scn.read();
                let b: usize = scn.read();
                (a, b)
            })
            .collect();
        ab.sort_by_key(|x| x.1);
        let mut time = 0;
        let mut ok = true;
        ab.iter().for_each(|(a, b)| {
            time += a;
            if time > *b {
                println!("No");
                ok = false;
            }
        });
        if ok {
            println!("Yes");
        }
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| {
            let mut solver = Solver::default();
            solver.solve()
        })
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: usize,
    }

    let mut sum_a = 0;
    let mut max_b = 0;
    for _ in 0..n {
        input! {
            a: u64,
            b: u64,
        }

        if a > b {
            println!("No");
            return;
        }

        sum_a += a;
        max_b = max_b.max(b);
    }
    if sum_a > max_b {
        println!("No");
    } else {
        println!("Yes");
    }
}


// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: usize,
    }

    let mut sum_a = 0;
    let mut max_b = 0;
    for _ in 0..n {
        input! {
            a: u64,
            b: u64,
        }

        sum_a += a;
        max_b = max_b.max(b);
    }
    if sum_a > max_b {
        println!("No");
    } else {
        println!("Yes");
    }
}


let n = Int(readLine()!)!

var tasks: [(cost: Int, deadline: Int)] = .init(repeating: (-1, -1), count: n)

for i in 0..<n {
  let inp = readLine()!.split(separator: " ").map { Int($0)! }
  tasks[i] = (inp[0], inp[1])
}

tasks = tasks.sorted { $0.deadline < $1.deadline }

var current = 0
var ans = true
for t in tasks {
  current += t.cost
  if current > t.deadline {
    ans = false
    break
  }
}
print(ans ? "Yes" : "No")


import Foundation

extension String {

    func toStrList() -> [String] {
        return self.map{String($0)}
    }

    func toIntList() -> [Int] {
        return self.map{Int(String($0))!}
    }

    func toSepDoubleList() -> [Double]{
        return self.split(separator: " ").map{Double($0)!}
    }

    func toSepIntList() -> [Int] {
        return self.split(separator: " ").map{Int($0)!}
    }

    func toSepStrList() -> [String] {
        return self.split(separator: " ").map{String($0)}
    }

    func zFill(n:Int) -> String {
        return String(format: "%0\(n)d", Int(self)!)
    }

    func count(c:Character) -> Int{
        var result = 0

        for e in self{
            if e == c{
                result += 1
            }
        }
        return result
    }

    func counter() -> Dictionary<Character, Int>{
        var result:[Character:Int] = [:]

        for c in self{
            guard let _ = result.index(forKey: c) else {
                result[c] = 1
                continue
            }
            result[c]! += 1
        }
        return result
    }
}

extension Int {
    func toBin() -> String {
        return String(self, radix: 2)
    }

    func toNBin(_ radix:Int) -> String{
        return String(self, radix: radix)
    }

    func toD() -> Double {
        return Double(self)
    }
}

extension Double {
    func toI() -> Int {
        return Int(self)
    }
}

extension Array where Element: Equatable{
    func count(n:Self.Element) -> Int{
        var result = 0
        for e in self{
            if e == n{
                result += 1
            }
        }
        return result
    }
}

extension Array {
    func dump(){
        for x in 0..<self.count-1{
            print(self[x], terminator: " ")
        }
        print(self.last!)
    }
}

func pow(_ base:Int,_ exp:Int) -> Int{
    let d = pow(base.toD(), exp.toD())
    return Int(d)
}

func distance(p1:CGPoint, p2:CGPoint) -> Double {
    let diffp = CGPoint(x:p1.x - p2.x, y:p1.y - p2.y)
    return Double(sqrt(diffp.x*diffp.x + diffp.y * diffp.y))
}

func distance(p1:[Double], p2:[Double]) -> Double{
    let diff = [p1[0] - p2[0], p1[1] - p2[1]]
    return sqrt(diff[0] * diff[0] + diff[1] * diff[1])

}

func lotate(theta:Double, point:[Double]) -> [Double] {
    let matrix = [
        [cos(theta), -sin(theta)],
        [sin(theta), cos(theta)]
    ]
    let x = point[0]
    let y = point[1]

    let rx = matrix[0][0]*x + matrix[0][1]*y
    let ry = matrix[1][0]*x + matrix[1][1]*y

    return [rx, ry]
}

func abc131d() -> String {
    let N = Int(readLine()!)!
    var AB = [[Int]](repeating: [], count: N)
    var now = 0
    for i in 0..<N{ AB[i].append(contentsOf: readLine()!.toSepIntList()) }
    AB.sort { (a, b) -> Bool in
        return a[1] < b[1]
    }
    for ab in AB {
        now += ab[0]
        if now > ab[1] {
            return "No"
        }
    }
    return "Yes"
}

print(abc131d())


let N = Int(readLine()!)!
let tasks: [(Int, Int)] = (0..<N).map { _ in
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    return (input[0], input[1])
}
var ans = "Yes"
var time = 0
for AB in tasks.sort({$0.1<$1.1}) {
    time += AB.0
    if time > AB.1 {
        ans = "No"
        break
    }
}
print(ans)


let N = Int(readLine()!)!
let tasks: [(Int, Int)] = (0..<N).map { _ in
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    return (input[0], input[1])
}
var ans = "Yes"
var time = 0
for AB in tasks.sort{$0.1<$1.1} {
    time += AB.0
    if time > AB.1 {
        ans = "No"
        break
    }
}
print(ans)


let N = Int(readLine()!)!
let tasks = [(Int, Int)]()
for _ in 0..<N {
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    tasks += [(input[0], input[1])]
}
tasks.sortInPlace{$0.1<$1.1}
var ans = "Yes"
var time = 0
for AB in tasks {
    time += AB.0
    if time > AB.1 {
        ans = "No"
        break
    }
}
print(ans)


var ans = "Yes"
var time = 0
for AB in ((0..<Int(readLine()!)!).map{_ in readLine()!.characters.split(" ").map{Int(String($0))!}}.sort{$0[1]<$1[1]}) {
    time += AB[0]
    if time > AB[1] {
        ans = "No"
        break
    }
}
print(ans)


import { readFileSync } from 'fs'

const canFinish = (works: number[][]) => {
  let totalTime = 0

  for (const [time, limit] of works) {
    totalTime += time
    if (totalTime > limit) {
      return false
    }
  }

  return true
}

function main(input: string) {
  const [[N], ...works] = input.split('\n').map(v => v.split(' ').map(Number))

  works.sort(([, a], [, b]) => a - b)

  console.log(canFinish(works) ? 'Yes' : 'No')
}

main(readFileSync('/dev/stdin', 'utf8').trim())


export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const n: number = parseInt(tmp[0]);
    const t: number[][] = tmp.slice(1, n + 1).map(l => l.split(" ").map(a => parseInt(a)));
    t.sort(([a1, b1], [a2, b2]) => b1 - b2);
    let time = 0;
    for (let i = 0; i < n; ++i) {
      time += t[i][0];
      if (time > t[i][1]) {
        return "No";
      }
    }
    return "Yes";
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const n = Number(stdin.split('\n')[0])
const [, ..._ab] = stdin.split('\n')
const ab = _ab.map(e => e.split(' ').map(Number))

const ans = () => {
  const sab = ab.sort((a, b) => a[1] - b[1])

  let t = 0
  for (let i = 0; i < n; i++) {
    const [a, b] = sab[i]

    t += a

    if (t > b) {
      return 'No'
    }
  }
  return 'Yes'
}

console.log(ans())


import * as fs from "fs"

const process = (n: number, ab: number[][]): string => {
  // Bi でソート
  const aabb = ab.sort((na, nb) => na[1] - nb[1])

  var num = 0
  for (var i = 0; i < n; i++) {
    num += aabb[i][0]
    if (num > aabb[i][1]) {
      return "No"
    }
  }

  return "Yes"
}

const Main = (input: string): string => {
  const aa: string[][] = input.split("\n").map((e) => e.split(" "))
  const a = parseInt(aa[0][0])
  aa.shift()
  const na: number[][] = aa.map((e) => e.map((e) => parseInt(e)))

  const res = process(a, na) + ""
  console.log(res)
  return res
}
Main(fs.readFileSync("/dev/stdin", "utf8"))


import * as fs from "fs"

const process = (n: number, ab: number[][]): string => {
  // Bi でソート
  const aabb = ab.sort((na, nb) => na[1] - nb[1])

  let num = 0
  for (let i = 0; i < n; i++) {
    num += aabb[i][0]
    if (num > aabb[i][1]) {
      return "No"
    }
  }

  return "Yes"
}

const Main = (input: string): string => {
  const aa: string[][] = input.split("\n").map((e) => e.split(" "))
  const a = parseInt(aa[0][0])
  aa.shift()
  const na: number[][] = aa.map((e) => e.map((e) => parseInt(e)))

  const res = process(a, na) + ""
  console.log(res)
  return res
}
Main(fs.readFileSync("/dev/stdin", "utf8"))


s = input().split()
ret = ""
for si in s:
    ret += si[0]
print(ret.upper())


# coding: utf-8

if __name__ == "__main__":
	s = input().split()
	print((s[0][0]+s[1][0]+s[2][0]).upper())


# -*- coding: utf-8 -*-
a, b, c = [n for n in input().split()]
print((a[0] + b[0] + c[0]).upper())


array=input().split()
tobeprinted=[]
print(array)
for i in range(3):
	tobeprinted.append(array[i][0].upper())
print(*tobeprinted,sep="")


a, b, c = input().split()

print(a[0]+b[0]+c[0])


a, b, c = input().split()
print((s1[0] + s2[0] + s3[0]).upper())


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	char a,b,c;
	public void solve() {
		a = next().charAt(0);
		b = next().charAt(0);
		c = next().charAt(0);

		String s = ""+((char)((a-'a')+'A')) + ((char)((b-'a')+'A')) + ((char)((c-'a')+'A'));
		out.println(s);
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] ana = new String[6];
		char[] c = new char[3];
		ana=line.split(" ");
		for(int i=0;i<3;i++){
		c[i]=ana[i].charAt(0);
		System.out.print(Character.toUpperCase(c[i]));
		}

	}
}


import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        for(int i=0;i<3;i++){
            System.out.print(fsc.next().toUpperCase().toCharArray()[0]);
        }
        fsc.close();

    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String b = sc.nextLine();
        String c = sc.nextLine();

        String ans = a.substring(0,1) + b.substring(0,1) +c.substring(0,1);

        System.out.println(ans.toUpperCase());
    }
}


import java.util.*;

public class Main{
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String ans = null;
        for(int i = 0; i < 3; i++){
            String s = sc.next();
            ans += s.charAt(0);
        }
        System.out.println(ans.toUpperCase());
    }
}


import java.util.*;

public class Main{
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        String s3 = sc.next();

        String ans = s1.charAt(0) + s2.charAt(0);
        ans += s3.charAt(0);
        System.out.println(ans.toUpperCase());
    }
}


#include<stdio.h>

int main(){
    char s1[1000],s2[1000],s3[1000];
    scanf("%s%s%s",s1,s2,s3);
    printf("%c%c%c\n",s1[0]-32,s2[0]-32,s3[0]-32);

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

char s1[15], s2[15], s3[15];
int main()
{
	while(scanf("%s %s %s", s1, s2, s3) != EOF)
	{
		//printf("%s %s %s\n", s1, s2, s3);
		printf("%c%c%c\n", s1[0] - 32, s2[0] - 32, s3[0] - 32);
		memset(s1, 0, sizeof(s1));
		memset(s2, 0, sizeof(s2));
		memset(s3, 0, sizeof(s3));
	}
}


#include<stdio.h>
#include<string.h>
char s1[15];
char s2[15];
char s3[15];
int main(){
	scanf("%s",s1);
	getchar();
	scanf("%s",s2);
	getchar();
	scanf("%s",s3);
	printf("%c%c%c",s1[0]-('a'-'A'),s2[0]-('a'-'A'),s3[0]-('a'-'A'));
}


#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>

#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>

using namespace std;

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  char d = 'A' - 'a';
  cout << a[0] + d << b[0] + d << c[0] + d << endl;
}


#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>

#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>

using namespace std;

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  char def = 'A' - 'a';
  cout << a[0] + def << b[0] + def << c[0] + def << endl;
}


#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)
#define ALL(x) (x).begin(),(x).end()
template<class T>bool umax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool umin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}

template<typename A,size_t N,typename T> void FILL(A (&array)[N],const T &val){fill((T*)array,(T*)(array+N),val);}
template<typename T> void FILL(vector<T> &v, const T &x) {fill(v.begin(), v.end(), x);}
template<typename T> void FILL(vector<vector<T>> &v, const T &x) {for(auto &i:v)fill(i.begin(), i.end(), x);}

int main() {
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  ll ans_p = 0;
  ll sum_p = 0;
  rep(i, n) {
    if(i%2) { // -
      if(sum_p + a[i] < 0) {
        sum_p += a[i];
      }
      else {
        ans_p += (sum_p+a[i]) + 1;
        sum_p = -1;
      }
    }
    else { // +
      if(sum_p + a[i] > 0) {
        sum_p += a[i];
      }
      else {
        ans_p += abs(sum_p+a[i]) + 1;
        sum_p = 1;
      }
    }
  }

  ll ans_m = 0;
  ll sum_m = 0;
  rep(i, n) {
    if(!(i%2)) { // +
      if(sum_m + a[i] < 0) {
        sum_m += a[i];
      }
      else {
        ans_m += (sum_m+a[i]) + 1;
        sum_m = -1;
      }
    }
    else { // -
      if(sum_m + a[i] > 0) {
        sum_m += a[i];
      }
      else {
        ans_m += abs(sum_m+a[i]) + 1;
        sum_m = 1;
      }
    }
  }
  cout << min(ans_m, ans_p) << endl;
}


#include <stdio.h>
#include <ctype.h>

int main(void)
{
  char s1[11], s2[11], s3[11];
  char u[11] = "";
  scanf("%s %s %s", s1, s2, s3);
  u[0] = toupper(s1[0]);
  u[1] = toupper(s2[0]);
  u[2] = toupper(s3[0]);
  puts(u);

  return 0;
}


#include <stdio.h>

int main(void)
{
    char acronym[4];
    for (int i = 0; i < 3; i++)
    {
        char str[11];
        if (scanf("%s", str) != 1) return 1;
        char initial = str[0];
        if (initial >= 'a' && initial <= 'z')
            initial -= 'a' - 'A';
        acronym[i] = initial;
    }
    acronym[3] = '\0';

    puts(acronym);

    return 0;
}


#include <stdio.h>
#include<stdlib.h>
#include<string.h>
char s1[20],s2[20],s3[20];
void input(){
    scanf("%s%s%s",s1,s2,s3);
}

int main(){
    char captal[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    input();
    printf("%c%c%c\n",captal[s1[0]-'a'],captal[s2[0]-'a'],captal[s3[0]-'a']);
    return 0;
}


#include<stdio.h>
int main(void){
	char s[3][10];
	for(int i=0;i<3;i++){
		scanf("%s",&s[i][0]);
	}
	printf("%s%s%s",&s[0][0]+('A'-'a'),&s[1][0]+('A'-'a'),&s[2][0]+('A'-'a'));

	return 0;
}


#include<stdio.h>
int main(void){
	char s[3][10];
	for(int i=0;i<3;i++){
		scanf("%c",&s[i][0]);
	}
	printf("%s%s%s",&s[0][0]+('A'-'a'),&s[1][0]+('A'-'a'),&s[2][0]+('A'-'a'));

	return 0;
}


#include<stdio.h>
int main(void){
	char s[3][10];
	for(int i=0;i<3;i++){
		scanf("%c",&s[i]);
	}
	printf("%s%s%s",&s[0][0]+('A'-'a'),&s[1][0]+('A'-'a'),&s[2][0]+('A'-'a'));

	return 0;
}


function Main(input) {
  console.log(input.split(/\s+/).map(function(str) {
    return str.substring(0, 1).toUpperCase();
  }).join(""));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


"use strict";
const Main = (input) =>{
	let xs = input.trim().split(' ');
    let a = xs[0].charAt(0).toUpperCase();
    let b = xs[1].charAt(0).toUpperCase();
    let c = xs[2].charAt(0).toUpperCase();
    console.log(a+b+c);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var a = tmp[0]
	var b = tmp[1]
	var c = tmp[2]
    var s = a[0]+b[0]+c[0]
    s=s.toUpperCase();

	//出力
	console.log('%s',s);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function main(input) {
  input = input.trim();
  const [a,b,c] = input.split(" ");
  let x = a.slice(0).toUpperCase() + b.slice(0).toUpperCase() + c.slice(0).toUpperCase();
  console.log(x);

}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


function main(input) {
  input = input.trim();
  const [a,b,c] = input.split(" ").map(Number);
  let x = a.slice(0,1).toUpperCase() + b.slice(0,1).toUpperCase() + c.slice(0,1).toUpperCase();
  console.log(x);

}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


function main(input) {
  input = input.trim();
  const [a,b,c] = input.split(" ").map(Number);
  let x = a.slice(0).toUpperCase() + b.slice(0).toUpperCase() + c.slice(0).toUpperCase();
  console.log(x);

}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


package main

import (
	"fmt"
	"strings"
)

func main() {
	var s1, s2, s3 string
	fmt.Scan(&s1, &s2, &s3)

	fmt.Println(strings.ToUpper(s1[0:1]+s2[0:1]+s3[0:1]))
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var s1, s2, s3 string
	fmt.Scan(&s1, &s2, &s3)

	fmt.Println(strings.ToUpper(s1[0:1]) + strings.ToUpper(s2[0:1]) + strings.ToUpper(s3[0:1]))
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var s1, s2, s3 string
	fmt.Scan(&s1, &s2, &s3)
	fmt.Printf("%s%s%s", strings.ToUpper(s1[0:1]), strings.ToUpper(s2[0:1]), strings.ToUpper(s3[0:1]))
}


package main

import (
	"fmt"
)

func main() {
	var (
		s1, s2, s3 string
	)

	fmt.Scan(&s1, &s2, &s3)

	fmt.Print(string(s1[0]) + string(s2[0]) + string(s3[0]))
}


package main

import (
  "bufio"
  "fmt"
  "os"
  "strings"
  "strconv"
)

func main()  {
  sc := bufio.NewScanner(os.Stdin)
  sc.Buffer(make([]byte, 64*1024*1024), 64*1024*1024)
  sc.Scan()
  n, _ := strconv.Atoi(sc.Text())
  sc.Scan()
  aArr := strings.Split(sc.Text(), " ")
  a := make([]int, n)
  for i := 0; i < n; i++ {
    a[i], _ = strconv.Atoi(aArr[i])
  }
  cnt := 0
  sum := a[0]
  for i := 1; i < n; i++ {
    if (sum+a[i])*sum < 0 {
      sum += a[i]
      continue
    } else if sum+a[i] < 0 {
      cnt += 1-(sum+a[i])
      sum = 1
    } else if sum+a[i] > 0{
      cnt += 1+(sum+a[i])
      sum = -1
    } else {
      cnt += 1
      if sum > 0 {
        sum = -1
      } else {
        sum = 1
      }
    }
  }
  fmt.Println(cnt)
}


a = gets.chomp.split
a.each do |n|
	print n[0].upcase
end


s = gets.chomp!.split
puts (s[0][0] + s[1][0] + s[2][0]).upcase


arrays = gets.split(' ')
i = 0
f = []
while i < arrays.size
  word = arrays[i].split('')
  w = word[0]
  f << w
  i += 1
end

puts f.join.upcase