N = int(eval(input()))

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

t = 0

for a, b in X:

    t += a

    if (t > b):

        print("No")

        exit()

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

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

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

t = 0

for a, b in X:

    t += a

    if (t > b):

        print("No")

        break

else:

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

N = int(eval(input()))
X = [tuple(map(int, input().split())) for _ in range(N)]
X.sort(key=lambda x: x[1])
t = 0
for a, b in X:
    t += a
    if t > b:
        print("No")
        break
else:
    print("Yes")

-X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[1]) +X = [tuple(map(int, input().split())) for _ in range(N)] +X.sort(key=lambda x: x[1]) -        exit() -print("Yes") +        break +else: +    print("Yes")