from heapq import heappush, heappop
n = input()
p = map(int, raw_input().split())
a = map(int, raw_input().split())
b = map(int, raw_input().split())
m = input()
c = map(int, raw_input().split())
colors = {}
for i in range(1, 4): colors[i] = []
for i in range(n):
heappush(colors[a[i]], (p[i], i))
if a[i] != b[i]: heappush(colors[b[i]], (p[i], i))
available = [1] * n
for i in range(m):
while True:
if len(colors[c[i]]) == 0:
print -1,
break
else:
price, index = heappop(colors[c[i]])
if available[index]:
available[index] = 0
print price,
break