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