# Read input permutations A and B A = list(map(int, input().split())) B = list(map(int, input().split())) # Compute the composition A ○ B result = [] for i in range(5): # B[i] is the value at position i+1 in permutation B # A[B[i] - 1] gives the value after applying A to B[i] result.append(str(A[B[i] - 1])) # Output the result print(' '.join(result))