#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  int n;
  int w[200005];
  priority_queue<pair<int, int>, vector<pair<int, int>>,
                 greater<pair<int, int>>>
      ipq;
  priority_queue<pair<int, int>> epq;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i]);
    pair<int, int> p = pair<int, int>(w[i], i);
    ipq.push(p);
  }
  int x;
  for (int i = 0; i < 2 * n; i++) {
    scanf("%1d", &x);
    if (x == 0) {
      pair<int, int> a = ipq.top();
      epq.push(a);
      ipq.pop();
      printf("%d ", a.second + 1);
    } else {
      pair<int, int> a = epq.top();
      epq.pop();
      printf("%d ", a.second + 1);
    }
  }
  return 0;
}
