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")
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")
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")

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")

-s = [] -c = 0 +x = [[0, 0]] -    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") +    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")