#include <bits/stdc++.h>
using namespace std;
int a[5001][5001];
void solve() {
  char ch;
  set<long long> s, s1, s2;
  long long n, w;
  map<long long, long long> make_pair;
  cin >> n;
  long long a[2 * n];
  for (long long int i = 0; i < n; i++) {
    cin >> w;
    s1.insert(w);
    make_pair[w] = i + 1;
  }
  long long x = 0, y = 1;
  for (long long int i = 0; i < 2 * n; i++) {
    cin >> ch;
    if (ch == '0') {
      auto it = s1.begin();
      w = *it;
      s2.insert(w);
      a[x] = make_pair[w];
      s1.erase(w);
      x += 2;
    } else {
      auto it = s2.end();
      it--;
      w = *it;
      a[y] = make_pair[*it];
      s2.erase(*it);
      y += 2;
    }
    cout << make_pair[w] << " ";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    solve();
    cout << "\n";
  }
  return 0;
}
