#include <bits/stdc++.h>
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
using namespace std;
int a[MAXN];
char tmp[MAXN];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q1;
priority_queue<pair<int, int>, vector<pair<int, int> >, less<pair<int, int> > >
    q2;
int main() {
  int n;
  scanf("%d", &(n));
  for (int i = 0; i < n; i++) {
    scanf("%d", &(a[i]));
    q1.push({a[i], i + 1});
  }
  scanf("%s", tmp);
  for (int i = 0; i < 2 * n; i++) {
    if (tmp[i] == '0') {
      pair<int, int> cur = q1.top();
      q1.pop();
      q2.push(cur);
      printf("%d ", cur.second);
    } else {
      pair<int, int> cur = q2.top();
      q2.pop();
      printf("%d ", cur.second);
    }
  }
  printf("\n");
  return 0;
}
