#include <bits/stdc++.h>
using namespace std;
int n;
struct Wp {
  int row;
  int width;
} w[200010];
char s[400010];
bool cmp(Wp aa, Wp bb) { return aa.width > bb.width; }
int hs[200010];
bool ocp[200010];
int main() {
  int i, j, pt_intro, hs_pt = -1, tmp;
  bool flag = true;
  scanf("%d", &n);
  pt_intro = n + 1;
  for (i = 1; i <= n; i++) {
    scanf("%d", &w[i].width);
    w[i].row = i;
    ocp[i] = false;
  }
  sort(w + 1, w + 1 + n, cmp);
  scanf("%s", s);
  for (i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      pt_intro--;
      printf("%d ", w[pt_intro].row);
      if (flag) {
        flag = false;
        hs_pt++;
        hs[hs_pt] = pt_intro;
      } else {
        hs[hs_pt]--;
      }
    } else {
      flag = true;
      tmp = w[hs[hs_pt]].row;
      printf("%d ", tmp);
      ocp[hs[hs_pt]] = true;
      hs[hs_pt]++;
      if (ocp[hs[hs_pt]]) {
        hs_pt--;
      }
    }
  }
  return 0;
}
