#include <bits/stdc++.h>
using namespace std;
const int maxn = 200100;
struct seat {
  int w, id;
  bool operator<(const seat& st) const { return w < st.w; }
  bool operator>(const seat& st) const { return w > st.w; }
};
seat st[maxn];
int n;
char tp[maxn * 2];
int main() {
  while (scanf("%d", &n) == 1) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &st[i].w);
      st[i].id = i;
    }
    scanf("%s", tp);
    sort(st + 1, st + 1 + n);
    priority_queue<seat, vector<seat>, less<seat>> que;
    int cnt = 1;
    for (int i = 0; i < n * 2; i++) {
      if (tp[i] == '0') {
        printf("%d ", st[cnt].id);
        que.push(st[cnt]);
        cnt++;
      } else {
        printf("%d ", que.top().id);
        que.pop();
      }
    }
    printf("\n");
  }
  return 0;
}
