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

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

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

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

-ABlist = sorted( -    [tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1] -) -now = 0 +ABlist = [list(map(int, input().split())) for _ in range(N)] +ABlist.sort(key=lambda x: x[1]) +time = 0 -    now += a -    if now <= b: -        continue -    else: +    time += a +    if time > b: