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