#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<int, int> w[200005];
  for (int i = 0; i < n; ++i) {
    scanf("%d", &w[i].first);
    w[i].second = i + 1;
  }
  sort(w, w + n);
  char a[400005];
  int sta[400005];
  scanf("%s", a);
  int cnt = 0;
  int inv = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (a[i] == '0') {
      printf("%d ", w[cnt].second);
      sta[inv++] = w[cnt].second;
      cnt++;
    } else {
      printf("%d ", sta[inv - 1]);
      inv--;
    }
  }
  return 0;
}
