#include <bits/stdc++.h>
using namespace std;
const int N = 500505;
const int mod = 1e9 + 7;
int w[N], n;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  set<pair<int, int> > zero, one;
  for (int i = 1; i <= n; ++i) cin >> w[i], zero.insert({w[i], i});
  for (int i = 1; i <= n + n; ++i) {
    char ch;
    cin >> ch;
    if (ch == '1') {
      auto it = --one.end();
      cout << it->second << ' ';
      one.erase(it);
    } else {
      auto it = zero.begin();
      cout << it->second << ' ';
      one.insert(*it);
      zero.erase(it);
    }
  }
  return 0;
}
