N = int(input()) S = list(input()) P = list(map(int, input().split())) ans = [] for i in range(N): ans.append(S[P[i] - 1]) print(*ans, sep="")