#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<int, int> w[n];
  for (int i = 0; i < n; i++) {
    cin >> w[i].first;
    w[i].second = i + 1;
  }
  sort(w, w + n);
  string s;
  cin >> s;
  int j = 0, k;
  char a[n][2];
  stack<int> v;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      cout << w[j].second << " ";
      v.push(j);
      j++;
    } else if (s[i] == '1') {
      a[v.top()][0] = '1';
      cout << w[v.top()].second << " ";
      v.pop();
    }
  }
}
