#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  long long n;
  cin >> n;
  long long mas[200500] = {};
  pair<long long, long long> sd[n];
  vector<long long> vec;
  for (int i = 0; i < n; i++) {
    cin >> sd[i].first;
    sd[i].second = i + 1;
  }
  sort(sd, sd + n);
  string s;
  cin >> s;
  long long ja = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      cout << sd[ja].second << " ";
      vec.push_back(sd[ja].second);
      ja++;
    }
    if (s[i] == '1') {
      cout << vec.back() << " ";
      vec.pop_back();
    }
  }
  return 0;
}
