#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k, t, l, n, m, x, y, z, t1, t2, t3, idx, flag = 1, a, b;
  cin >> n;
  string ch;
  vector<pair<long long, long long> > v;
  for (i = 0; i < n; i++) {
    cin >> a;
    v.push_back(make_pair(a, i + 1));
  }
  cin >> ch;
  l = ch.length();
  sort(v.begin(), v.end());
  deque<pair<long long, long long> > q1, q2;
  vector<long long> ans;
  for (i = 0; i < n; i++) {
    q1.push_back(make_pair(v[i].first, v[i].second));
  }
  for (i = 0; i < l; i++) {
    if (ch[i] == '0') {
      cout << q1.front().second << " ";
      q2.push_front(make_pair(q1.front().first, q1.front().second));
      q1.pop_front();
    } else {
      cout << q2.front().second << " ";
      q2.pop_front();
    }
  }
  return 0;
}
