N=int(eval(input()))

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

#print(AB)



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

#print(AB)



res=0

for i in range(N):

  res+=AB[i][0]

  if res>AB[i][1]:

    print("No")

    break

  if i==N-1:

    print("Yes")
N = int(eval(input()))

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



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



sum_a = 0

for a, b in AB:

  sum_a += a

  if sum_a > b:

    print("No")

    exit()

print("Yes")
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
# print(AB)
AB = sorted(AB, key=lambda x: x[1])
# print(AB)
res = 0
for i in range(N):
    res += AB[i][0]
    if res > AB[i][1]:
        print("No")
        break
    if i == N - 1:
        print("Yes")

N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
sum_a = 0
for a, b in AB:
    sum_a += a
    if sum_a > b:
        print("No")
        exit()
print("Yes")

-# print(AB) -AB = sorted(AB, key=lambda x: x[1]) -# print(AB) -res = 0 -for i in range(N): -    res += AB[i][0] -    if res > AB[i][1]: +AB.sort(key=lambda x: x[1]) +sum_a = 0 +for a, b in AB: +    sum_a += a +    if sum_a > b: -        break -    if i == N - 1: -        print("Yes") +        exit() +print("Yes")