#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  map<int, int> m;
  for (int i = 0; i < n; i++) cin >> v[i], m[v[i]] = i + 1;
  sort(v.begin(), v.end());
  string s;
  cin >> s;
  int i = 0;
  list<int> q;
  for (int j = 0; j < s.length(); j++) {
    if (s[j] == '0') {
      cout << m[v[i]] << " ";
      q.push_front(i);
      i++;
    } else {
      int k = q.front();
      q.pop_front();
      cout << m[v[k]] << " ";
    }
  }
  return 0;
}
