N=int(eval(input()))

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

time=0

flag=1

task.sort(lambda x:x[1])

#print(task)

for i in range(N):

    time=time+task[i][0]

    if not(time<=task[i][1]):

        flag=0

        break

if flag==1:

    print("Yes")

else:

    print("No")

N=int(eval(input()))

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

time=0

flag=1

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

#print(task)

for i in range(N):

    time=time+task[i][0]

    if not(time<=task[i][1]):

        flag=0

        break

if flag==1:

    print("Yes")

else:

    print("No")
N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
time = 0
flag = 1
task.sort(lambda x: x[1])
# print(task)
for i in range(N):
    time = time + task[i][0]
    if not (time <= task[i][1]):
        flag = 0
        break
if flag == 1:
    print("Yes")
else:
    print("No")

N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
time = 0
flag = 1
task.sort(key=lambda x: x[1])
# print(task)
for i in range(N):
    time = time + task[i][0]
    if not (time <= task[i][1]):
        flag = 0
        break
if flag == 1:
    print("Yes")
else:
    print("No")

-task.sort(lambda x: x[1]) +task.sort(key=lambda x: x[1])