#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > se, se1;
set<pair<int, int> >::iterator it;
int main() {
  int i, j, k, l, n = 0, m = 0;
  string second;
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%d", &j);
    se.insert(make_pair(j, i));
  }
  cin >> second;
  for (i = 0; i < second.size(); i++)
    if (second[i] == '0') {
      it = se.begin();
      pair<int, int> te = *it;
      printf("%d ", te.second + 1);
      se1.insert(make_pair(te.first, te.second));
      se.erase(it);
    } else {
      it = se1.end();
      it--;
      pair<int, int> te = *it;
      printf("%d ", te.second + 1);
      se1.erase(it);
    }
  return 0;
}
