Students of group 199 have written their lectures dismally. Now an exam on Mathematical Analysis is approaching and something has to be done asap (that is, quickly). Let's number the students of the group from 1 to n. Each student i (1 ≤ i ≤ n) has a best friend p[i] (1 ≤ p[i] ≤ n). In fact, each student is a best friend of exactly one student. In other words, all p[i] are different. It is possible that the group also has some really "special individuals" for who i = p[i].

Each student wrote exactly one notebook of lecture notes. We know that the students agreed to act by the following algorithm: 

  * on the first day of revising each student studies his own Mathematical Analysis notes, 
  * in the morning of each following day each student gives the notebook to his best friend and takes a notebook from the student who calls him the best friend. 



Thus, on the second day the student p[i] (1 ≤ i ≤ n) studies the i-th student's notes, on the third day the notes go to student p[p[i]] and so on. Due to some characteristics of the boys' friendship (see paragraph 1), each day each student has exactly one notebook to study.

You are given two sequences that describe the situation on the third and fourth days of revising:

  * a1, a2, ..., an, where ai means the student who gets the i-th student's notebook on the third day of revising; 
  * b1, b2, ..., bn, where bi means the student who gets the i-th student's notebook on the fourth day of revising. 



You do not know array p, that is you do not know who is the best friend to who. Write a program that finds p by the given sequences a and b.

Input

The first line contains integer n (1 ≤ n ≤ 105) — the number of students in the group. The second line contains sequence of different integers a1, a2, ..., an (1 ≤ ai ≤ n). The third line contains the sequence of different integers b1, b2, ..., bn (1 ≤ bi ≤ n).

Output

Print sequence n of different integers p[1], p[2], ..., p[n] (1 ≤ p[i] ≤ n). It is guaranteed that the solution exists and that it is unique.

Examples

Input

4
2 1 4 3
3 4 2 1


Output

4 3 1 2 

Input

5
5 2 3 1 4
1 3 2 4 5


Output

4 3 2 5 1 

Input

2
1 2
2 1


Output

2 1

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation

Constructive algorithms


Solutions:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = {}
for i in range(n):
	d[a[i]] = b[i]
for i in range(1, n + 1):
	print(d[i], end=' ')
print()


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = [0] * n
for (i, j) in zip(il(), il()):
	l[i - 1] = j
print(*l)


n = int(input())
(a, b) = (list(map(int, input().split())), list(map(int, input().split())))
(p, q) = ([0] * (n + 1), [0] * n)
for (i, j) in enumerate(a, 1):
	p[j] = i
for (i, j) in enumerate(b):
	q[i] = str(p[j])
print(' '.join(q))


n = int(input())
L = [int(i) for i in input().split()]
M = [int(i) for i in input().split()]
N = sorted(list(zip(L, M)))
[print(t[1], end=' ') for t in N]


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(zip(a, b))
c = sorted(c, key=lambda x: (x[0], x[1]))
for i in range(n):
	print(c[i][1], end=' ')


x = int(input())
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
bestFriends = {}
for (i, j) in zip(a, b):
	bestFriends[i] = j
for i in range(x):
	print(bestFriends[i + 1], end=' ')


import math
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ind = defaultdict(lambda : 0)
for i in range(n):
	ind[a[i]] = i + 1
for i in b:
	print(ind[i], end=' ')


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
dic = {}
for i in range(0, len(a)):
	dic[a[i]] = i
pic = []
for i in b:
	pic.append(dic[i] + 1)
for i in pic:
	print(i, end=' ')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = [0] * n
for i in range(len(a)):
	l[a[i] - 1] = b[i]
print(*l)


import sys
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = [None] * (n + 100)
for i in range(n):
	ans[a[i]] = b[i]
for i in range(1, n + 1):
	sys.stdout.write(str(ans[i]) + ' ')


(n, a, b) = (int(input()), list(map(int, input().split())), list(map(int, input().split())))
p = [0] * (n + 1)
for i in range(n):
	p[a[i]] = b[i]
print(' '.join(map(str, p[1:])))


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = [None] * len(a)
for i in range(len(a)):
	ans[a[i] - 1] = b[i]
print(*ans)


from sys import stdin, stdout
n = int(stdin.readline())
ans = [0 for i in range(n + 1)]
(a, b) = (list(map(int, stdin.readline().split())), list(map(int, stdin.readline().split())))
for i in range(n):
	ans[a[i]] = b[i]
stdout.write(' '.join(list(map(str, ans[1:]))))


n = int(input())
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
p = {}
for i in range(n):
	p[a[i] - 1] = b[i]
c = []
for i in range(n):
	c.append(p[i])
	print(c[-1], end=' ')


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
l = [0] * (n + 1)
for i in range(n):
	l[a[i]] = b[i]
print(*l[1:])


def main():
	n = int(input())
	a = [int(e) for e in input().split()]
	b = [int(e) for e in input().split()]
	p = [i for i in range(0, n + 1)]
	for i in range(n):
		p[a[i]] = b[i]
	print(' '.join(list(map(str, p[1:]))))
	return 0
main()


def inverse_permutation(a):
	n = len(a)
	q = [0 for i in range(n)]
	for i in range(n):
		q[a[i]] = i
	return q

def mul(a, b):
	n = len(a)
	c = [0 for i in range(n)]
	for i in range(n):
		c[i] = a[b[i]]
	return c

def main():
	n = int(input())
	a = list(map(lambda x: int(x) - 1, input().split()))
	b = list(map(lambda x: int(x) - 1, input().split()))
	p = mul(inverse_permutation(a), b)
	for i in range(n):
		p[i] += 1
	print(*p)
main()


n = int(input())
l1 = list(map(int, input().split(' ')))
l2 = list(map(int, input().split(' ')))
dic = {}
for x in range(len(l1)):
	dic[l1[x]] = x
for x in range(len(l2)):
	print(dic[l2[x]] + 1, end=' ')


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
d = {}
for i in range(n):
	d[l1[i]] = i + 1
for j in range(n):
	print(d[l2[j]], end=' ')


n = int(input())
a = [0]
b = [0]
x = [int(a) for a in input().split()]
a.extend(x)
y = [int(a) for a in input().split()]
b.extend(y)

def func_exe(a, b):
	n = len(a)
	aDict = {}
	bDict = {}
	resDict = {}
	for i in range(1, n):
		aDict[a[i]] = i
		bDict[i] = b[i]
	for i in range(1, n):
		resDict[i] = aDict[bDict[i]]
	return resDict
ans = func_exe(a, b)
for i in range(1, n + 1):
	print(ans[i], end=' ')


import sys

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	indexof = [0] * (n + 1)
	for i in range(n):
		indexof[a[i]] = i
	res = [0] * n
	for i in range(n):
		res[i] = indexof[b[i]] + 1
	return ' '.join(map(str, res))
if sys.hexversion == 50594544:
	sys.stdin = open('test.txt')
print(solve())


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p = [0] * n
for (i, a1) in enumerate(a):
	p[a1 - 1] = b[i]
for x in p:
	print(x, ' ', end='')
print()


n = int(input())
before = list(map(int, input().split()))
after = list(map(int, input().split()))
permutation = n * [None]
for i in range(n):
	permutation[before[i] - 1] = after[i]
print(' '.join(map(str, permutation)))


n = int(input())
p = list(map(int, input().split()))
rank = [0 for i in range(n + 2)]
for i in range(n):
	rank[p[i]] = i + 1
p = list(map(int, input().split()))
for i in range(n):
	p[i] = rank[p[i]]
print(' '.join((str(x) for x in p)))


def f(l1, l2):
	n = len(l1)
	t1 = [(l1[i], i) for i in range(n)]
	t2 = [(l2[i], i) for i in range(n)]
	t1.sort(key=lambda t: t[0])
	t2.sort(key=lambda t: t[0])
	p = [0] * n
	for i in range(n):
		p[t2[i][1]] = t1[i][1] + 1
	return p
q = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
print(*f(l1, l2))