#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int widths[n];
  vector<pair<int, int> > in, ex;
  for (int i = 0; i < n; i++) {
    cin >> widths[i];
    in.push_back(make_pair(widths[i], i + 1));
  }
  sort(in.begin(), in.end());
  string ps = "";
  cin >> ps;
  int inctr = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (ps[i] == '0') {
      ex.push_back(in[inctr]);
      cout << in[inctr].second << " ";
      inctr++;
    } else if (ps[i] == '1') {
      cout << ex.back().second << " ";
      ex.pop_back();
    }
  }
  return 0;
}
