#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  ;
  int n, i;
  cin >> n;
  long long k;
  vector<pair<long long, int>> w;
  for (i = 1; i <= n; i++) {
    cin >> k;
    w.push_back(make_pair(k, i));
  }
  sort(w.begin(), w.end());
  string s;
  cin >> s;
  priority_queue<pair<int, int>> pq;
  int cur = 0;
  for (i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      pq.push(w[cur]);
      cout << w[cur].second << " ";
      cur++;
    } else {
      cout << pq.top().second << " ";
      pq.pop();
    }
  }
}
