N = int(eval(input()))

tasks = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])



tmp = 0

for c, t in tasks:

    tmp += c

    if tmp > t:

        print('No')

        exit()

print('Yes')

N = int(eval(input()))

tasks = sorted((tuple(map(int, input().split())) for _ in range(N)), key=lambda x: x[1])



tmp = 0

for c, t in tasks:

    tmp += c

    if tmp > t:

        print('No')

        exit()

print('Yes')

N = int(eval(input()))
tasks = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])
tmp = 0
for c, t in tasks:
    tmp += c
    if tmp > t:
        print("No")
        exit()
print("Yes")

N = int(eval(input()))
tasks = sorted((tuple(map(int, input().split())) for _ in range(N)), key=lambda x: x[1])
tmp = 0
for c, t in tasks:
    tmp += c
    if tmp > t:
        print("No")
        exit()
print("Yes")

-tasks = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1]) +tasks = sorted((tuple(map(int, input().split())) for _ in range(N)), key=lambda x: x[1])