#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<pair<int, int>> vacant;
  vector<pair<int, int>> filled;
  int x;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    vacant.push_back({x, i});
  }
  string s;
  cin >> s;
  int i = 0;
  sort(vacant.begin(), vacant.end());
  for (char c : s) {
    if (c == '0') {
      cout << vacant[i].second << " ";
      filled.push_back(vacant[i]);
      i++;
    }
    if (c == '1') {
      cout << (filled.back()).second << " ";
      filled.pop_back();
    }
  }
  return 0;
}
