#include <bits/stdc++.h>
using namespace std;
bool ff(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int> > w(n);
  vector<int> B;
  for (int i = 0; i < n; i++) {
    cin >> w[i].first;
    w[i].second = i;
  }
  sort((w).begin(), (w).end(), ff);
  string s;
  cin >> s;
  int Blen = 0;
  int temp = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      cout << w[temp].second + 1 << " ";
      B.push_back(w[temp].second + 1);
      Blen++;
      temp++;
    } else {
      cout << B[Blen - 1] << " ";
      B.pop_back();
      Blen--;
    }
  }
  return 0;
}
