N = int(input()) S = input() P = list(map(int,input().split())) ans = [''] * N for i,p in enumerate(P): ans[i] = S[p-1] print(''.join(ans))