#include <bits/stdc++.h>
using namespace std;
struct node {
  int state;
  int row;
  int pow;
  node(int s, int r, int p) : state(s), row(r), pow(p){};
  node() {}
};
struct rule0 {
  bool operator()(const node &a, const node &b) {
    return a.pow < b.pow || a.pow == b.pow && a.row < b.row;
  }
};
struct rule1 {
  bool operator()(const node &a, const node &b) {
    return a.pow > b.pow || a.pow == b.pow && a.row < b.row;
  }
};
int main() {
  set<node, rule1> st1;
  set<node, rule0> st0;
  set<node, rule0>::iterator it0;
  set<node, rule1>::iterator it1;
  int n;
  cin >> n;
  int pow;
  for (int i = 0; i < n; i++) {
    cin >> pow;
    node tmp(0, i + 1, pow);
    st0.insert(tmp);
  }
  string people;
  cin >> people;
  for (int i = 0; people[i]; i++) {
    if (people[i] == '0') {
      it0 = st0.begin();
      if (it0 != st0.end()) {
        node tmp = *it0;
        st0.erase(it0);
        tmp.state++;
        st1.insert(tmp);
        printf("%d%c", tmp.row, i == 2 * n - 1 ? '\n' : ' ');
        continue;
      } else {
        it1 = st1.begin();
        node tmp = *it1;
        st1.erase(it1);
        printf("%d%c", tmp.row, i == 2 * n - 1 ? '\n' : ' ');
        continue;
      }
    } else {
      it1 = st1.begin();
      if (it1 == st1.end()) {
        it0 = st0.begin();
        node tmp = *it0;
        st0.erase(it0);
        tmp.state++;
        st1.insert(tmp);
        printf("%d%c", tmp.row, i == 2 * n - 1 ? '\n' : ' ');
        continue;
      } else {
        node tmp = *it1;
        st1.erase(it1);
        printf("%d%c", tmp.row, i == 2 * n - 1 ? '\n' : ' ');
        continue;
      }
    }
  }
}
