#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  pair<int, int> data[n];
  int ans[2 * n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &data[i].first);
    data[i].second = i + 1;
  }
  string config;
  cin >> config;
  sort(data, data + n);
  deque<int> q;
  for (int i = 0, j = 0, k = 0; i < 2 * n; i++) {
    if (config[i] == '0') {
      ans[i] = data[j++].second;
      q.push_front(data[j - 1].second);
    } else {
      ans[i] = q.front();
      q.pop_front();
    }
  }
  for (int i = 0; i < 2 * n; i++) printf("%d ", ans[i]);
  return 0;
}
