#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> tab[200001];
string s;
bool tabx[200001];
vector<int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tab[i].first;
    tab[i].second = i;
  }
  sort(tab, tab + n);
  cin >> s;
  int in = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      cout << tab[in].second + 1 << " ";
      v.push_back(in);
      in++;
    } else {
      cout << tab[v.back()].second + 1 << " ";
      v.pop_back();
    }
  }
  return 0;
}
