N = int(eval(input()))

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

X = sorted(X, key = lambda x: x[1])



# a[i]はA[i]まで終わらせるためにかかる累積時間

a = [0] * N

a[0] = X[0][0]

for i in range(1, N):

	a[i] = a[i - 1] + X[i][0]



for j in range(N):

	if a[j] > X[j][1]:

		print("No")

		exit()

print("Yes")

# 締切の早いものから順番に見ていくのが最適戦略

N = int(eval(input()))

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

X = sorted(X, key=lambda x: x[1])  # B (締切の早い順にソート)



res = 0

for i in range(N):

    res += X[i][0]

    if res > X[i][1]:

        print("No")

        exit()

print("Yes")

N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
X = sorted(X, key=lambda x: x[1])
# a[i]はA[i]まで終わらせるためにかかる累積時間
a = [0] * N
a[0] = X[0][0]
for i in range(1, N):
    a[i] = a[i - 1] + X[i][0]
for j in range(N):
    if a[j] > X[j][1]:
        print("No")
        exit()
print("Yes")

# 締切の早いものから順番に見ていくのが最適戦略
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
X = sorted(X, key=lambda x: x[1])  # B (締切の早い順にソート)
res = 0
for i in range(N):
    res += X[i][0]
    if res > X[i][1]:
        print("No")
        exit()
print("Yes")

+# 締切の早いものから順番に見ていくのが最適戦略 -X = sorted(X, key=lambda x: x[1]) -# a[i]はA[i]まで終わらせるためにかかる累積時間 -a = [0] * N -a[0] = X[0][0] -for i in range(1, N): -    a[i] = a[i - 1] + X[i][0] -for j in range(N): -    if a[j] > X[j][1]: +X = sorted(X, key=lambda x: x[1])  # B (締切の早い順にソート) +res = 0 +for i in range(N): +    res += X[i][0] +    if res > X[i][1]: