#include <bits/stdc++.h>
using namespace std;
int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
const int MAX_N = 100005;
typedef struct hi {
  int num;
  int wi;
  friend bool operator<(hi a, hi b) { return a.wi < b.wi; }
} SEAT;
typedef struct hii {
  int num;
  int wi;
  friend bool operator<(hii a, hii b) { return a.wi > b.wi; }
} SEATT;
bool cmp(SEAT a, SEAT b) { return a.wi < b.wi; }
int main() {
  int n;
  scanf("%d", &n);
  ;
  SEATT c[200005];
  priority_queue<SEATT> q2;
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i].wi);
    ;
    c[i].num = i + 1;
    q2.push(c[i]);
  }
  char m[200005];
  scanf("%s", m);
  ;
  priority_queue<SEAT> q1;
  for (int(i) = 0; (i) < n * 2; (i)++) {
    if (m[i] == '0') {
      printf("%d ", q2.top().num);
      SEAT temp;
      temp.num = q2.top().num;
      temp.wi = q2.top().wi;
      q1.push(temp);
      q2.pop();
    }
    if (m[i] == '1') {
      printf("%d ", q1.top().num);
      q1.pop();
    }
  }
}
