#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, id;
} a[410000];
int ans[410000];
int n, l, w;
char s[410000];
int b[410000];
bool cmp(node x, node y) { return x.x < y.x; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].x), a[i].id = i;
  scanf("%s", s + 1);
  sort(a + 1, a + n + 1, cmp);
  l = 1;
  w = 0;
  for (int i = 1; i <= n * 2; i++)
    if (s[i] == '0') {
      ans[i] = a[l].id;
      w++;
      b[w] = a[l].id;
      l++;
    } else {
      ans[i] = b[w];
      w--;
    }
  for (int i = 1; i <= n * 2; i++) printf("%d ", ans[i]);
  return 0;
}
