n = int(eval(input()))

AB = [list(map(int, input().split())) for _ in range(n)]

AB.sort(key=lambda x: (x[1], -x[0]))

time = 0

for a, b in AB:

    time += a

    if time > b:

        print('No')

        break

else:

    print('Yes')

n = int(eval(input()))

AB = [list(map(int, input().split())) for _ in range(n)]

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

time = 0

for a, b in AB:

    time += a

    if time > b:

        print('No')

        break

else:

    print('Yes')

n = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=lambda x: (x[1], -x[0]))
time = 0
for a, b in AB:
    time += a
    if time > b:
        print("No")
        break
else:
    print("Yes")

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

-AB.sort(key=lambda x: (x[1], -x[0])) +AB.sort(key=lambda x: (x[1]))