import sys
line_1 = input().split()
n,m = int(line_1[0]),int(line_1[1])
work_re = []
while n:
if len(sys.stdin.readline().strip()):
continue
line = sys.stdin.readline().strip().split()
work_re.append([int(x) for x in line])
n=n-1
end_counter=1
while end_counter:
if len(sys.stdin.readline().strip()):
continue
m_cap = [int(x) for x in sys.stdin.readline().strip().split()]
end_counter=end_counter-1
work_re.sort()
res = []
for i in m_cap:
tag = None
for j in work_re:
if j[0] <= i:
tag = j
res.append(tag[1])
for p in res:
print(p)
line_1 = input().split()
n,m = int(line_1[0]),int(line_1[1])
work_re = []
while n:
if len(sys.stdin.readline().strip()):
continue
line = sys.stdin.readline().strip().split()
work_re.append([int(x) for x in line])
n=n-1
end_counter=1
while end_counter:
if len(sys.stdin.readline().strip()):
continue
m_cap = [int(x) for x in sys.stdin.readline().strip().split()]
end_counter=end_counter-1
work_re.sort()
res = []
for i in m_cap:
tag = None
for j in work_re:
if j[0] <= i:
tag = j
res.append(tag[1])
for p in res:
print(p)
通过率百分之10