a=sorted(list(map(int,input().split()))) d=list(''.join(input())) d=[ord(x)-65 for x in d] e=[] for b in d: e.append(str(a[b])) print(' '.join(e))