n = int(input()) s = input() a = list(map(int, input().split())) for x in a: print(s[x-1], end="") print()