#include <bits/stdc++.h>
using namespace std;
const int INF = ~(1 << 31);
const double E = exp(1);
const double Pi = 4 * atan(1.0);
const int N = 2e5 + 5;
int n;
char s[2 * N];
struct row {
  int w;
  int num;
  bool operator<(const row& x) const { return w < x.w; }
} a[N];
struct row1 {
  int w;
  int num;
  bool operator<(const row1& x) const { return w < x.w; }
};
int main() {
  scanf("%d", &n);
  priority_queue<row1> q;
  int i, j, x;
  for (i = 0; i <= n - 1; ++i) {
    scanf("%d", &a[i].w);
    a[i].num = i;
  }
  sort(a, a + n);
  scanf("%s", s);
  int pos = 0;
  for (i = 0; i <= 2 * n - 1; ++i) {
    int x = s[i] - '0';
    if (x == 0) {
      cout << a[pos].num + 1 << ' ';
      row1 t;
      t.w = a[pos].w;
      t.num = a[pos].num;
      q.push(t);
      ++pos;
    } else {
      row1 t = q.top();
      q.pop();
      cout << t.num + 1 << ' ';
    }
  }
  return 0;
}
