A = list(map(int, input().split())) B = list(map(int, input().split())) C = [0] * 5 for i in range(5): C[i] = A[B[i] - 1] print(*C)