#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  char w;
  priority_queue<int> maxq;
  priority_queue<int> minq;
  map<int, int> Map;
  map<int, int>::iterator mit;
  int ara[200005];
  char pass[2 * 200005];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t);
    ara[i - 1] = t;
    mit = Map.find(t);
    if (mit == Map.end()) Map[t] = i;
  }
  sort(ara, ara + n);
  n *= 2;
  int k = 0;
  scanf("%s", pass);
  w = pass[0];
  if (w == '0') {
    cout << Map[ara[k]];
    maxq.push(ara[k++]);
  } else {
    cout << Map[maxq.top()];
    maxq.pop();
  }
  for (int i = 1; i < n; i++) {
    w = pass[i];
    if (w == '0') {
      cout << ' ' << Map[ara[k]];
      maxq.push(ara[k++]);
    } else {
      cout << ' ' << Map[maxq.top()];
      maxq.pop();
    }
  }
  cout << endl;
}
