#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, j = 0;
  priority_queue<pair<long long, long long> > q;
  cin >> n;
  vector<pair<long long, long long> > w(n);
  string s;
  vector<long long> res(2 * n, 99);
  for (long long i = 0; i < n; ++i) {
    w[i].second = i;
    cin >> w[i].first;
  }
  cin >> s;
  sort(w.begin(), w.end());
  for (long long i = 0; i < s.size(); ++i) {
    if (s[i] == '0') {
      res[i] = w[j].second;
      q.push(w[j]);
      j++;
    } else {
      res[i] = q.top().second;
      q.pop();
    }
  }
  for (long long i = 0; i < 2 * n; ++i) {
    cout << res[i] + 1 << " ";
  }
  return 0;
}
