#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
inline long long MAX(long long a, long long b) { return (a > b) ? (a) : (b); }
inline long long MIN(long long a, long long b) { return (a < b) ? (a) : (b); }
int main() {
  int const sz = 4e5 + 10;
  long long i, j, q, k, x, a[sz + 1], n;
  string s;
  cin >> n;
  map<long long, long long> intr, extr;
  for (i = 0; i <= n - 1; i++) {
    cin >> a[i];
    intr[a[i]] = i;
  }
  cin >> s;
  int ans[sz + 1];
  for (i = 0; i <= s.length() - 1; i++) {
    if (s[i] == '0') {
      int u = intr.begin()->second;
      ans[i] = u;
      extr[-intr.begin()->first] = u;
      intr.erase(intr.begin());
    }
    if (s[i] == '1') {
      int u = extr.begin()->second;
      ans[i] = u;
      extr.erase(extr.begin());
    }
  }
  for (i = 0; i <= s.length() - 1; i++) cout << ans[i] + 1 << " ";
  return 0;
}
