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