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