#include <bits/stdc++.h>
using namespace std;
int arr[200001];
map<int, int> ar;
int main() {
  int n, p;
  stack<int> st;
  string s;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    ar[arr[i]] = i + 1;
  }
  cin >> s;
  sort(arr, arr + n);
  p = 0;
  for (int i = 0; i < n * 2; i++) {
    if (s[i] == '0') {
      st.push(ar[arr[p]]);
      cout << ar[arr[p]] << " ";
      p++;
    } else {
      cout << st.top() << " ";
      st.pop();
    }
  }
}
