#include <bits/stdc++.h>
using namespace std;
int v[200005], jump[200005];
bool check[200005];
string s;
map<int, int> m;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    m[v[i]] = i;
  }
  cin >> s;
  sort(v + 1, v + n + 1);
  int i = 1, j = 1;
  for (int k = 0; k < s.size(); k++) {
    if (s[k] == '0') {
      cout << m[v[i]] << " ";
      jump[i] = j;
      j = i;
      i++;
    } else {
      if (check[j] == 0) {
        check[j] = 1;
        cout << m[v[j]] << " ";
      } else {
        while (check[j] == 1) j = jump[j];
        check[j] = 1;
        cout << m[v[j]] << " ";
      }
    }
  }
  return 0;
}
