#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  string s;
  map<long long, long long> m;
  long long b[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
    m[a[i]] = i + 1;
  }
  cin >> s;
  sort(b, b + n);
  long long x = 0, y = n - 1;
  stack<long long> st;
  for (long long i = 0; i < 2 * n; i++) {
    if (s[i] == '1') {
      if (!st.empty()) {
        long long k = st.top();
        st.pop();
        cout << k << " ";
      } else {
        cout << m[b[y]] << " ";
        y--;
      }
    } else {
      st.push(m[b[x]]);
      cout << m[b[x]] << " ";
      x++;
    }
  }
  return 0;
}
