CodeEff/ECCO huggingface dataset:
# Original solution
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#from itertools import groupby as gb
#from itertools import permutations as perm
#from itertools import combinations as comb
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
#A, B, C = map(int, stdin.readline().rstrip().split())
#S = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(h)]
A = []
B = []
for i in range(n):
    a,b = list(map(int, stdin.readline().rstrip().split()))
    A.append(a)
    B.append(b)

now = 0

for i in range(n):
    small = B.index(min(B))
    now += A[small]
    if now > min(B):
        print("No")
        exit()
    else:
        B[small] = INF

print("Yes")


# Optimized solution
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#from itertools import groupby as gb
#from itertools import permutations as perm
#from itertools import combinations as comb
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
#A, B, C = map(int, stdin.readline().rstrip().split())
#w = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(n)]
ab = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
now = 0

for i in range(n):
    now += ab[i][0]
    if now > ab[i][1]:
        print("No")
        exit()

print("Yes")
# Original solution
N=int(eval(input()))
AB=[]
for i in range(N):
    A,B,=list(map(int,input().split()))
    AB.append([A,B])
AB.sort(key=lambda x:x[1])
t=0
for i in range(N):
    t+=AB[i][0]
    if t>AB[i][1]:
        print("No")
        quit()
print("Yes")


# Optimized solution
N=int(eval(input()))
AB=[list(map(int,input().split())) for i in range(N)]
AB.sort(key=lambda x:x[1])
t=0
for a,b in AB:
    t+=a
    if t>b:
        print("No")
        quit()
print("Yes")
# Original solution
N=int(eval(input()))
BA=[[0,0] for _ in range(N)]

for i in range(N):
    BA[i][1],BA[i][0]=list(map(int,input().split()))
BA.sort()

t=0
ans="Yes"
for i in range(N):
    t+=BA[i][1]
    if t>BA[i][0]:
        ans="No"
        break
print(ans)

# Optimized solution
import sys
input = sys.stdin.readline

def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    Q=[]
    for _ in range(N):
        a,b=MI()
        Q.append([b,a])
        
    Q.sort()
    now=0
    flag=1
    for i in range(N):
        b,a=Q[i]
        now+=a
        if now>b:
            flag=0
            break
            
    if flag:
        print("Yes")
    else:
        print("No")
        

main()
# Original solution
N=int(eval(input()))
li_=[]
for i in range(N):
  A,B=list(map(int,input().split()))
  li_.append((B,A))
li_.sort()
time=0
for i in range(N):
  time+=li_[i][1]
  if time>li_[i][0]:
    print("No")
    exit()
print("Yes")


# Optimized solution
N=int(eval(input()))
a=list()
for _ in range(N):
  A,B=list(map(int,input().split()))
  a.append((B,A))
a.sort()
t=0
for i in range(N):
  t+=a[i][1]
  if t>a[i][0]:
    print("No")
    exit()
print("Yes")
# Original solution
N = int(eval(input()))
L = [[int(a) for a in input().split()] for _ in range(N)]

from operator import itemgetter

L.sort(key=itemgetter(1))

t = 0
ans = "Yes"
for i in range(N):
    if L[i][0] > L[i][1]-t:
        ans = "No"
        break
    else:
        t += L[i][0]
        
print(ans)

# Optimized solution
N = int(eval(input()))
L = [[int(l) for l in input().split()] for _ in range(N)]

from operator import itemgetter
L.sort(key=itemgetter(1))
time = 0
ans = "Yes"
for i in range(N):
    time += L[i][0]
    if time > L[i][1]:
        ans = "No"
        break
print(ans)
# Original solution
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
ab = []
for _ in range(n):
    abi = na()
    ab.append(abi)

ab.sort(key=lambda x:x[1])
t = 0
for i in range(n):
    t += ab[i][0]
    if t > ab[i][1]:
        print("No")
        quit()
print("Yes")


# Optimized solution
import sys
stdin = sys.stdin
from itertools import accumulate

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n = ni()
ab = list()
for _ in range(n):
    ab.append(na())

ab.sort(key=lambda x:x[1])
time = 0
for ai, bi in ab:
    time += ai
    if time > bi:
        print("No")
        quit()
print("Yes")
# Original solution
n = int(eval(input()))
tasks = []
for _ in range(n):
    a,b = list(map(int, input().split()))
    tasks.append([a,b])

tasks.sort()
tasks = sorted( tasks, key = lambda a: a[1] )

time = 0
flg = 0
for task in tasks:
    time += task[0]
    if time > task[1]:
        flg = 1
print(( 'No' if flg else 'Yes' ))

# Optimized solution
import sys
input = sys.stdin.readline

n = int(eval(input()))
tasks = []
for _ in range(n):
    a,b = list(map(int, input().split()))
    tasks.append((a,b))

tasks.sort()
tasks = sorted( tasks, key = lambda a: a[1] )

time = 0
flg = 0
for task in tasks:
    time += task[0]
    if time > task[1]:
        print('No')
        break
else:
    print( 'Yes' )
# Original solution
a = int(eval(input()))
b = []
for i in range(a):
    c, d = list(map(int, input().split()))
    b.append([d, c])
b.sort()
c = 0
for i in range(a):
    c += b[i][1]
    if c > b[i][0]:
        print("No")
        exit()
print("Yes")


# Optimized solution
a = int(eval(input()))
b = [list(map(int, input().split())) for _ in range(a)]
b = sorted(b, key=lambda x: x[1])
c = 0
for i in range(a):
    c += b[i][0]
    if c > b[i][1]:
        print("No")
        exit()
print("Yes")
# Original solution
from operator import itemgetter

N = int(eval(input()))

wl = [tuple(map(int, input().split())) for _ in range(N)]
wl.sort(key=itemgetter(1))
# (work_time, time_limit)

cur = 0
can = True
for t, lmt in wl:
    cur += t
    if cur > lmt:
        can = False
        break
print(('Yes' if can else 'No'))


# Optimized solution
n = int(eval(input()))
e = []
for _ in range(n):
    a, b = list(map(int, input().split()))
    e.append((b, a))
e.sort()

cur = 0
can = True
for b, a in e:
    cur += a
    if cur > b:
        can = False
        break

print(('Yes' if can else 'No'))
# Original solution
n = int(eval(input()))
e = []
for _ in range(n):
    a, b = list(map(int, input().split()))
    e.append((b, a))
e.sort()

cur = 0
can = True
for b, a in e:
    cur += a
    if cur > b:
        can = False
        break

print(('Yes' if can else 'No'))


# Optimized solution
n = int(eval(input()))
tlm = [tuple(map(int, input().split())) for _ in range(n)]
# time/limit

tlm.sort(key=lambda x: x[1])

flg = True
cur = 0
for t, lm in tlm:
    cur += t
    if cur > lm:
        flg = False
        break

print(('Yes' if flg else 'No'))
# Original solution
N = int(eval(input()))

AB = []
for n in range(N):
    AB.append(list(map(int,input().split())))

aaa = sorted(AB, key=lambda x:(x[1], x[0]))

sumW = 0
for a in aaa:
    sumW += a[0]
    if sumW > a[1]:
        print('No')
        exit()

print('Yes')

# Optimized solution
N = int(eval(input()))

AB = []
for n in range(N):
    AB.append(list(map(int,input().split())))

aaa = sorted(AB, key=lambda x:(x[1]))

sumW = 0
for a in aaa:
    sumW += a[0]
    if sumW > a[1]:
        print('No')
        exit()

print('Yes')
# Original solution
n = int(eval(input()))
w = []
for i in range(n):
    a,b = list(map(int,input().split()))
    w.append([a,b])
w.sort(key=lambda x:x[1])
time = 0
for i in range(n):
    time += w[i][0]
    if time > w[i][1]:
        print("No")
        exit()
print("Yes")


# Optimized solution
n = int(eval(input()))
task = []
for i in range(n):
    a,b = list(map(int,input().split()))
    task.append((a,b))
task.sort(key=lambda x:x[1])
time = 0
deadline = 0
for i in range(n):
    time += task[i][0]
    deadline = task[i][1]
    if time > deadline:
        print("No")
        exit()
print("Yes")
# Original solution
import sys
n = int(eval(input()))
ab = []
for i in range(n):
    a,b = list(map(int,input().split()))
    ab.append([a,b])
ab = sorted(ab,key=lambda x:x[1])
limit = 0
for i in range(n):
    limit += ab[i][0]
    if limit > ab[i][1]:
        print("No")
        sys.exit()

print("Yes")

# Optimized solution
import sys

n = int(eval(input()))
ab = []
for i in range(n):
    a,b = list(map(int,input().split()))
    ab.append([a,b])
    
ab.sort(key=lambda x:x[1])

limit = 0
for i in range(n):
    limit += ab[i][0]
    if limit > ab[i][1]:
        print("No")
        sys.exit()

print("Yes")
# Original solution
from operator import itemgetter
n=int(eval(input()))
d=[]
judge=True
bag=[]
for i in range(n):
    a,b=list(map(int,input().split()))
    d.append([a,b])
d.sort(key=itemgetter(1))
        
for j in range(len(d)):
    bag.append(d[j][0])
    if sum(bag)>d[j][1]:
        judge=False
else:
    if judge==True:
        print("Yes")
    else:
        print("No")

# Optimized solution
n=int(eval(input()))
bag=[]
ans="Yes"
total=0
for i in range(n):
    a,b=list(map(int,input().split()))
    bag.append([a,b])
d=sorted(bag, key=lambda x:x[1])

for j in range(n):
    total=total+d[j][0]
    if total>d[j][1]:
        ans="No"
        break

print(ans)
# Original solution
import sys
from operator import itemgetter

def solve():
    input = sys.stdin.readline
    N = int(eval(input()))
    W = [[int(w) for w in input().split()] for _ in range(N)]
    W.sort()
    W.sort(key = itemgetter(1))
    time = 0
    for i, w in enumerate(W):
        if time + w[0] > w[1]:
            print("No")
            break
        else:
            time += w[0]
    else: print("Yes")

    return 0

if __name__ == "__main__":
    solve()

# Optimized solution
import sys
from operator import itemgetter

def solve():
    input = sys.stdin.readline
    N = int(eval(input()))
    work = [[int(i) for i in input().split()] for _ in range(N)]
    work.sort(key = itemgetter(1))
    currentTime = 0
    for i in range(N):
        a, b = work[i]
        if a + currentTime <= b:
            currentTime += a
        else:
            print("No")
            break
    else: print("Yes")

    return 0

if __name__ == "__main__":
    solve()
# Original solution
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(eval(input()))
    L = [list(map(int,input().split())) for k in range(N)]
    L = sorted(L,key = lambda x: (x[1],x[0]))
    t = 0
    for e in L:
        if t+e[0] > e[1]:
            print("No")
            exit(0)
        else:
            t += e[0]
    print("Yes")
if __name__ == '__main__':
    main()


# Optimized solution
import sys

def main():
    def input():
        return sys.stdin.readline()[:-1]
    N = int(eval(input()))
    L = [list(map(int,input().split())) for k in range(N)]
    L = sorted(L,key = lambda x: (x[1],x[0]))
    t = 0
    for e in L:
        if t+e[0] > e[1]:
            print("No")
            exit(0)
        else:
            t += e[0]
    print("Yes")
if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
li = [list(map(int,input().split())) for _ in range(n)]

li.sort(key = lambda x: x[1])

time = 0

for i,j in li:
    time += i
    if time > j:
        print('No')
        exit()

print('Yes')


# Optimized solution
import sys
input = sys.stdin.readline

n = int(eval(input()))
li = [list(map(int,input().split())) for _ in range(n)]

li.sort(key = lambda x: x[1])

time = 0

for i,j in li:
    time += i
    if time > j:
        print('No')
        exit()

print('Yes')
# Original solution
n=int(eval(input()))
time=0
tasks=[]
for i in range(n):
  tasks.append(list(map(int,input().split())))
tasks.sort(key=lambda x:x[1])
flag=0
for i in range(n):
  time+=tasks[i][0]
  if time>tasks[i][1]:
    flag=1
    break
if flag==0:
  print("Yes")
else:
  print("No")

# Optimized solution
import sys
input= sys.stdin.readline
n=int(eval(input()))
time=0
tasks=[]
for i in range(n):
  tasks.append(list(map(int,input().split())))
tasks.sort(key=lambda x:x[1])
flag=0
for i in range(n):
  time+=tasks[i][0]
  if time>tasks[i][1]:
    flag=1
    break
if flag==0:
  print("Yes")
else:
  print("No")
# Original solution
n = int(eval(input()))
l = []
s = 0
for i in range(n):
  a, b = list(map(int, input().split()))
  s += a
  l.append((a, b))
  
l = sorted(l, key=lambda x: x[1], reverse=True)
for i in range(n):
  if s > l[0][1]:
    print("No")
    exit()
  else:
    a = l.pop(0)
    s -= a[0]
print("Yes")

# Optimized solution
n = int(eval(input()))
l = []
s = 0
for i in range(n):
  a, b = list(map(int, input().split()))
  s += a
  l.append((a, b))
  
l = sorted(l, key=lambda x: x[1])
for i in range(n):
  if s > l[-1][1]:
    print("No")
    exit()
  else:
    a = l.pop()[0]
    s -= a
print("Yes")
# Original solution
n = int(eval(input()))
l = []
s = 0
for i in range(n):
  a, b = list(map(int, input().split()))
  s += a
  l.append((a, b))
  
l = sorted(l, key=lambda x: x[1])
for i in range(n):
  if s > l[-1][1]:
    print("No")
    exit()
  else:
    a = l.pop()[0]
    s -= a
print("Yes")

# Optimized solution
n = int(eval(input()))
l = []
s = 0
for i in range(n):
  a, b = list(map(int, input().split()))
  s += a
  l.append((a, b))
  
l = sorted(l, key=lambda x: x[1])
for i in range(n):
  if s > l[-i-1][1]:
    print("No")
    exit()
  else:
    s -= l[-i-1][0]
    
print("Yes")
# Original solution
n = int(eval(input()))
s = []
c = 0
for _ in range(n):
    a, b = list(map(int, input().split()))
    s.append([b, a])
s.sort()
for i in range(n):
    c += s[i][1]
    if c > s[i][0]:
        c = -1
        break
if c != -1:
    print("Yes")
else:
    print("No")

# Optimized solution
n = int(eval(input()))
x = [[0, 0]]
for _ in range(n):
    a, b = list(map(int, input().split()))
    x.append([b, a])
x.sort()
for i in range(1, n + 1):
    x[i][1] += x[i - 1][1]
    if x[i][0] < x[i][1]:
        print("No")
        exit()
print("Yes")
# Original solution
N = int(eval(input()))
res = 'Yes'
A = [[0 for j in range(2)] for i in range(N)]
for i in range(N):
  A[i][0], A[i][1] = list(map(int, input().split(' ')))
A.sort(key=lambda x: x[1])
A.append([0, 0])
total = 0
i = 0
while i < N:
  while True:
    total += A[i][0]
    if A[i][1] != A[i + 1][1]:
      break
    i += 1
  if A[i][1] < total:
    res = 'No'
    break
  i += 1
print(res)

# Optimized solution
N = int(eval(input()))
A_B = [[0 for _ in range(2)] for _ in range(N)]
total = 0
res = 'Yes'
for i in range(N):
  A_B[i][0], A_B[i][1] = list(map(int, input().split(' ')))
A_B.sort(key=lambda x: x[1])
for i in range(N):
  total += A_B[i][0]
  if total > A_B[i][1]:
    res = 'No'
    break
print(res)
# Original solution
# -*- coding: utf-8 -*-
def solve():
    N = int(eval(input()))
    Limit = dict()
    for i in range(N):
        A, B = list(map(int, input().split()))
        New = not B in list(Limit.keys())
        Limit[B] = Limit.get(B,0) + A
        if Limit[B] > B:
            return 'No'
        else:
            tk = 0
            for k in list(Limit.keys()):
                if New and k < B:
                    tk = max(tk, k)

                if k > B:
                    Limit[k] += A
                    if Limit[k] > k:
                        return 'No'
            Limit[B] += Limit.get(tk,0)
            if Limit[B] > B:
                return 'No'

    return 'Yes'

if __name__ == '__main__':
    print((solve()))


# Optimized solution
# -*- coding: utf-8 -*-
from heapq import heappush, heappop

def solve():
    N = int(eval(input()))
    hq = []
    for i in range(N):
        A, B = list(map(int, input().split()))
        heappush(hq, (B,A))

    time = 0
    cost = 0
    while hq:
        l, c = heappop(hq)
        if time == l:
            cost += c
        else:
            time = l
            cost += c
        if cost > time:
            return 'No'
    return 'Yes'
if __name__ == '__main__':
    print((solve()))
# Original solution
from operator import itemgetter

n = int(eval(input()))
a = []
res = ('Yes')
for i in range(n):
    a.append(list(map(int,input().split())))

a.sort(key=itemgetter(1))
for i in range(0,n):
    suma = 0
    for j in range(0,i+1):
        suma += a[j][0]
    if suma > a[i][1]:
        res = ('No')
        break


print(res)

# Optimized solution
from operator import itemgetter

n = int(eval(input()))
a = []
res = ('Yes')
for i in range(n):
    a.append(list(map(int,input().split())))

a.sort(key=itemgetter(1))
suma = 0
for i in range(0,n):
    suma += a[i][0]
    if suma > a[i][1]:
        res = ('No')
        break


print(res)
# Original solution
N = int(eval(input()))
X=[0]*N
for i in range(N):
    X[i] = list(map(int, input().split()))
X.sort(key=lambda x:x[1])
def check():
    now = 0
    for i in range(N):
        now += X[i][0]
        if now > X[i][1]:
            return 'No'
    return 'Yes'
print((check()))

# Optimized solution
def check():
    N = int(eval(input()))
    X = [list(map(int, input().split())) for _ in range(N)]
    X.sort(key=lambda x:x[1])
    now = 0
    for a,b in X:
        now += a
        if now>b:
            return 'No'
    return 'Yes'
print((check()))
# Original solution
N = int(eval(input()))
AB = [list(map(int,input().split())) for i in range(N)]

sortedAB = sorted(AB, key= lambda x: x[1])

import sys
work = 0

for i in range(N):
    work += sortedAB[i][0]
    if work > sortedAB[i][1]:
        print('No')
        sys.exit()
        
print('Yes')

# Optimized solution
N = int(eval(input()))
AB = [list(map(int,input().split())) for i in range(N)]

sort_AB = sorted(AB, key= lambda x: x[1])
ans = 'Yes'
tmp = 0

for i in range(N):
    tmp += sort_AB[i][0]
    if tmp > sort_AB[i][1]:
        ans = 'No'
        break
        
print(ans)
# Original solution
import sys
input = lambda: sys.stdin.readline()[:-1]
n=int(eval(input()))
data=[tuple(map(int,input().split())) for i in range(n)]
data.sort(key=lambda tup:tup[1])
time=0
for offer in data:
	time+=offer[0]
	if time > offer[1]:
		print('No')
		break
else:print('Yes')


# Optimized solution
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n=int(eval(input()))
ab=[]
for i in range(n):
    ab.append(tuple(map(int,input().split())))
ab.sort(key=lambda tup:tup[1])
time=0
for a,b in ab:
    time+=a
    if time>b:
        print('No')
        exit()
print('Yes')
# Original solution
#りゅうせいの解答3
N = int(eval(input()))
task_list = [list(map(int, input().split())) for i in range(N)]

task_list.sort(key=lambda task_list: task_list[1])
time = 0
flag = True

for j in range(N):
    x = task_list.pop(0)
    time += x[0]
    if time > x[1]:
        flag = False
        break

if flag:
    print("Yes")

else:
    print("No")




#りゅうせいの解答2 正解
# N = int(input())
# task_list = [list(map(int, input().split())) for i in range(N)]
#
# task_list.sort(key=lambda task_list: task_list[1])
# time = 0
# flag = True
#
# for i in range(N):
#     x = task_list[i]
#     time += x[0]
#     if time > x[1]:
#         flag = False
#         break
#
# if flag:
#     print("Yes")
#
# else:
#     print("No")




#りゅうせいの解答1　実行時エラー(exit(1)が原因）、実行時間超過
# N = int(input())
# task_list = [list(map(int,input().split())) for i in range(N)]
#
# task_list.sort(key= lambda task_list: task_list[1])
# time = 0
#
# while(len(task_list)):
#     x = task_list.pop(0)
#     time += x[0]
#     if time > x[1]:
#         print("No")
#         exit(1)
#
#     else:
#         continue
#
# print("Yes")

# Optimized solution
#りゅうせいの解答3
N = int(eval(input()))
task_list = [list(map(int, input().split())) for i in range(N)]

task_list.sort(key=lambda task_list: task_list[1])
time = 0
flag = True

j = 0
while(j < N):
    x = task_list[j]
    time += x[0]
    if time > x[1]:
        flag = False
        break
    j += 1

if flag:
    print("Yes")

else:
    print("No")




#りゅうせいの解答2 正解
# N = int(input())
# task_list = [list(map(int, input().split())) for i in range(N)]
#
# task_list.sort(key=lambda task_list: task_list[1])
# time = 0
# flag = True
#
# for i in range(N):
#     x = task_list[i]
#     time += x[0]
#     if time > x[1]:
#         flag = False
#         break
#
# if flag:
#     print("Yes")
#
# else:
#     print("No")




#りゅうせいの解答1　実行時エラー(exit(1)が原因）、実行時間超過
# N = int(input())
# task_list = [list(map(int,input().split())) for i in range(N)]
#
# task_list.sort(key= lambda task_list: task_list[1])
# time = 0
#
# while(len(task_list)):
#     x = task_list.pop(0)
#     time += x[0]
#     if time > x[1]:
#         print("No")
#         exit(1)
#
#     else:
#         continue
#
# print("Yes")
# Original solution
N = int(eval(input()))

sche = [[0,0] for i in range(N)]

for i in range(N):
    tmp_a, tmp_b = list(map(int, input().split()))
    sche[i][0] = tmp_a
    sche[i][1] = tmp_b



def search_lms(N, sche, now):
    sub_time = 10000000000
    num = 0
    for i in range(len(sche)):
        if sub_time > sche[i][1]:
            sub_time = sche[i][1]
            num = i
    return num
        #差の最小値を見つける

now = 0
tmp = 0
for i in range(N):
    tmp = search_lms(N, sche, now)
    if now + sche[tmp][0] > sche[tmp][1]:
        print("No")
        exit()
    now += sche[tmp][0]
    sche.pop(tmp)

print("Yes")

# Optimized solution
N = int(eval(input()))
work = [list(map(int, input().split())) for i in range(N)]

work = sorted(work, key = lambda x: x[1])

time = 0
for i in range(N):
    time += work[i][0]
    if time > work[i][1]:
        print("No")
        exit()
print("Yes")
# Original solution
N = int(eval(input()))
A,B,C=[None]*N,[None]*N,dict()
for i in range(N):
  A[i],B[i] = [int(j) for j in input().split()]
  if not B[i] in C:
    C[B[i]] = []
  C[B[i]] += [[A[i],B[i]]]
C = sorted(list(C.items()), key=lambda C:C[0])
s=0
for k,v in C:
  for i in v:
    s+=i[0]
    if i[1]<s:
      print('No')
      exit()

print('Yes')

# Optimized solution
N = int(eval(input()))
C=dict()
for i in range(N):
 A,B = [int(j) for j in input().split()]
 if not B in C:
   C[B] = []
 C[B] += [A]
C = sorted(list(C.items()), key=lambda C:C[0])
s=0
for k,v in C:
    s+=sum(v)
    if k<s:
        print('No')
        exit()
print('Yes')
# Original solution
n = int(eval(input()))
ab = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: (x[1], x[0]))
tt = 0
for i in ab:
    tt += i[0]
    if tt > i[1]:
        print("No")
        exit()
print("Yes")


# Optimized solution
def main():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
    ab = sorted(ab, key=lambda x: x[1])
    t = 0
    for a, b in ab:
        t += a
        if t > b:
            print("No")
            exit()
    print("Yes")


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
ABlist = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])
now = 0
for a, b in ABlist:
    now += a
    if now <= b:
        continue
    else:
        print("No")
        break
else:
    print("Yes")


# Optimized solution
N = int(eval(input()))
ABlist = [list(map(int, input().split())) for _ in range(N)]
ABlist.sort(key=lambda x: x[1])
time = 0
for a, b in ABlist:
    time += a
    if time > b:
        print("No")
        break
else:
    print("Yes")