#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
char s[MAXN * 2];
int n;
set<pair<int, int>> empty, seated;
int main() {
  scanf("%d", &n);
  for (int i = 1, w; i <= n; ++i) scanf("%d", &w), empty.insert({w, i});
  scanf("%s", s);
  for (int i = 0; i < (n << 1); ++i) {
    int idx = -1;
    if (s[i] == '0') {
      pair<int, int> p = *empty.begin();
      idx = p.second;
      seated.insert(p);
      empty.erase(p);
    } else {
      pair<int, int> p = *seated.rbegin();
      idx = p.second;
      seated.erase(p);
    }
    if (i) printf(" ");
    printf("%d", idx);
  }
  return 0;
}
