I'm angry!!!

n = int(input())
w = [[-int(x), i + 1] for (i, x) in enumerate(input().split(' '))] #enumerate返回元素和其下标
w.sort(key = lambda x : x[0])                                      # 多维数组排序
m = input()
e = [];
res = [];

for x in m:
    if x == '0':
        res.append(w[len(w) - 1][1])
        e.append(w.pop()[1])
    else:
        res.append(e.pop());

print(' '.join(map(str, res)))                                     #join拼