#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  long long a;
  cin >> n;
  vector<long long> v;
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      mn;
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>>
      mx;
  for (int i = 0; i < n; i++) {
    cin >> a;
    mn.push({a, i + 1});
  }
  string s;
  cin >> s;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      pair<long long, long long> p = mn.top();
      v.push_back(p.second);
      mn.pop();
      mx.push(p);
    } else {
      pair<long long, long long> p = mx.top();
      v.push_back(p.second);
      mx.pop();
    }
  }
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  return 0;
}
