N = int(input())
arr = list(map(int, input().split()))
lst = []
for i in range(N):
if i == 0:
lst.insert(0, i+1)
else:
lst.insert(arr[i], i+1)
for i in reversed(lst):
print(i, end=" ")
N = int(input())
arr = list(map(int, input().split()))
lst = []
for i in range(N):
if i == 0:
lst.insert(0, i+1)
else:
lst.insert(arr[i], i+1)
for i in reversed(lst):
print(i, end=" ")