#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 1;
int n, a[maxn];
set<pair<int, int> > s1, s2;
string w;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s1.insert({a[i], i});
  }
  cin >> w;
  for (int i = 0; i < 2 * n; i++) {
    if (w[i] == '0') {
      int t = (*s1.begin()).second;
      cout << t << " ";
      s1.erase(s1.begin());
      s2.insert({a[t], t});
    } else {
      auto tt = s2.end();
      tt--;
      cout << (*tt).second << " ";
      s2.erase(tt);
    }
  }
  cout << endl;
  return 0;
}
