#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int w[n];
  set<pair<int, int>> set_n, set_x;
  for (int i = 0; i < n; ++i) {
    cin >> w[i];
    set_n.insert({w[i], i});
  }
  string s;
  cin >> s;
  for (int i = 0; i < 2 * n; ++i) {
    if (s[i] == '0') {
      auto x = *set_n.begin();
      cout << x.second + 1 << " ";
      set_n.erase(x);
      set_x.insert(x);
    } else {
      auto x = *set_x.rbegin();
      cout << x.second + 1 << " ";
      set_x.erase(x);
    }
  }
}
