#include <bits/stdc++.h>
using namespace std;
int a[200005];
struct Node {
  int w;
  int id;
};
struct cmpn {
  bool operator()(Node &x, Node &y) { return x.w > y.w; }
};
struct cmpw {
  bool operator()(Node &x, Node &y) { return x.w < y.w; }
};
priority_queue<Node, vector<Node>, cmpn> Qnei;
priority_queue<Node, vector<Node>, cmpw> Qwai;
char str[400005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int wi;
    cin >> wi;
    Node now;
    now.id = i;
    now.w = wi;
    Qnei.push(now);
  }
  cin >> str;
  int n_str = strlen(str);
  for (int i = 0; i < n_str; i++) {
    if (str[i] == '1') {
      Node p = Qwai.top();
      cout << ' ' << p.id;
      Qwai.pop();
    } else {
      Node p = Qnei.top();
      if (i == 0) {
        cout << p.id;
      } else {
        cout << ' ' << p.id;
      }
      Qnei.pop();
      Qwai.push(p);
    }
  }
  return 0;
}
