#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  priority_queue<pair<int, int>, vector<pair<int, int>>,
                 greater<pair<int, int>>>
      El;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    El.push(make_pair(x, i));
  }
  priority_queue<pair<int, int>> Mr;
  string s;
  cin >> s;
  pair<int, int> p;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      p = El.top();
      El.pop();
      cout << p.second << " ";
      Mr.push(p);
    } else {
      p = Mr.top();
      Mr.pop();
      cout << p.second << " ";
    }
  }
  cout << endl;
  return 0;
}
