#include <bits/stdc++.h>
using namespace std;
bool compare(pair<long int, long int> a, pair<long int, long int> b) {
  return (a.second < b.second);
}
int main() {
  long int n, i, j, index, a;
  string s;
  cin >> n;
  vector<pair<long int, long int> > w;
  for (i = 0; i < n; i++) {
    cin >> a;
    w.push_back(make_pair(a, i + 1));
  }
  sort(w.begin(), w.end());
  cin >> s;
  priority_queue<pair<long int, long int> > pq;
  j = -1;
  for (i = 0; i < (2 * n); i++) {
    if (s[i] == '0') {
      j++;
      pq.push(w[j]);
      cout << w[j].second << " ";
    } else if (s[i] == '1') {
      cout << pq.top().second << " ";
      pq.pop();
    }
  }
  return 0;
}
