#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  signed long long n;
  cin >> n;
  vector<pair<signed long long, signed long long>> in;
  deque<pair<signed long long, signed long long>> ex;
  signed long long r[2 * n + 3];
  for (signed long long i = 0; i < n; i++) {
    signed long long x;
    cin >> x;
    in.push_back({x, i + 1});
  }
  sort(in.begin(), in.end());
  signed long long ct1 = 0, ct2 = 0;
  string s;
  cin >> s;
  for (signed long long i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      r[i] = in[ct1].second;
      ex.push_front(in[ct1]);
      ct1++;
    } else {
      pair<signed long long, signed long long> y = ex.front();
      r[i] = y.second;
      ex.pop_front();
      ct2++;
    }
  }
  for (signed long long i = 0; i < 2 * n; i++) cout << r[i] << " ";
  cout << endl;
  return 0;
}
