def Main(): n=int(input()) s=input() p=list(map(int,input().split())) for i in range(n): print(s[p[i]-1],end="") print() Main()