N = int(eval(input()))

AB = [[0]*2 for i in range(N)]



for i in range(N):

    AB[i] = list(map(int, input().split()))



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



time = 0

for i in range(N):

    time += AB[i][0]

    if time > AB[i][1]:

        print("No")

        exit(0)



print("Yes")

N = int(eval(input()))

AB = [tuple(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:

        continue

    else:

        print("No")

        exit(0)

print("Yes")

N = int(eval(input()))
AB = [[0] * 2 for i in range(N)]
for i in range(N):
    AB[i] = list(map(int, input().split()))
AB = sorted(AB, key=lambda x: x[1])
time = 0
for i in range(N):
    time += AB[i][0]
    if time > AB[i][1]:
        print("No")
        exit(0)
print("Yes")

N = int(eval(input()))
AB = [tuple(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:
        continue
    else:
        print("No")
        exit(0)
print("Yes")

-AB = [[0] * 2 for i in range(N)] -for i in range(N): -    AB[i] = list(map(int, input().split())) -AB = sorted(AB, key=lambda x: x[1]) -time = 0 -for i in range(N): -    time += AB[i][0] -    if time > AB[i][1]: +AB = [tuple(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: +        continue +    else: