#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int i;
  int a[n];
  vector<pair<int, int> > v;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    v.push_back(make_pair(a[i], i));
  }
  sort(v.begin(), v.end());
  string s;
  cin >> s;
  int x = 0;
  map<int, int> m;
  map<int, int>::iterator it;
  for (i = 0; i < s.length(); i++) {
    if (s[i] == '0') {
      cout << (v[x].second) + 1 << " ";
      m[v[x].first] = v[x].second + 1;
      x++;
    } else {
      it = m.end();
      it--;
      cout << it->second << " ";
      m.erase(it->first);
    }
  }
  return 0;
}
