#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  priority_queue<pair<long long, long long> > extr;
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      intr;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    intr.push(pair<long long, long long>(a, i + 1));
  }
  for (int i = 0; i < 2 * n; ++i) {
    if (i) cout << " ";
    char x;
    cin >> x;
    if (x == '0') {
      pair<long long, long long> cur = intr.top();
      intr.pop();
      cout << cur.second;
      extr.push(cur);
    } else {
      pair<long long, long long> cur = extr.top();
      extr.pop();
      cout << cur.second;
    }
  }
  cout << endl;
}
