#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
struct node {
  int date;
  int id;
  friend bool operator<(node a, node b) { return a.date < b.date; }
} p[maxn];
priority_queue<node> q;
bool cmp(node a, node b) { return a.date < b.date; }
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    p[i].date = a, p[i].id = i;
  }
  sort(p + 1, p + 1 + n, cmp);
  cin >> s;
  int k = 1;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      cout << p[k].id << " ";
      q.push(p[k++]);
    } else {
      struct node t;
      t = q.top();
      cout << t.id << " ";
      q.pop();
    }
  }
  return 0;
}
