#include <bits/stdc++.h>
using namespace std;
__inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
__inline string next_line() {
  const int SIZE = 1100000;
  static char buf[SIZE + 1];
  static int p = SIZE;
  string res;
  int f = 1;
  while ((p < SIZE || (p = 0, buf[fread(buf, 1, SIZE, stdin)] = 0, buf[0])) &&
         (buf[p] != '\n' && (res += buf[p], f = 0, 1) || f))
    ++p;
  return res;
}
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);
const int MAXN = 5e5 + 5;
const int MOD = 1e9 + 7;
int sgn(double x) {
  if (fabs(x) < eps) return 0;
  if (x < 0)
    return -1;
  else
    return 1;
}
int n, w;
char s[MAXN];
priority_queue<pair<int, int> > Q1, Q2;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w);
    Q1.push(make_pair(-w, i));
  }
  scanf("%s", s);
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      pair<int, int> t = Q1.top();
      Q1.pop();
      printf("%d ", t.second);
      t.first *= -1;
      Q2.push(t);
    } else {
      pair<int, int> t = Q2.top();
      Q2.pop();
      printf("%d ", t.second);
    }
  }
  printf("\n");
}
