n = int(eval(input()))

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

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



time = 0

for x,y in lst:

    time += x

    if time > y:

        print('No')

        break

else:

    print('Yes')
n = int(eval(input()))

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

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



time = 0

for x,y in lst:

    time += x

    if time > y:

        print('No')

        exit()

else:

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

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

-        break +        exit()