#include <bits/stdc++.h>
using namespace std;
long long int r, l, x, y, n, m, i, z, p, s, e, q, j, k, c, d, t, h, sum = 0;
string s1, s2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  long long int w[n + 1];
  vector<pair<long long int, long long int> > v;
  for (long long int i = 1; i < n + 1; i++) {
    cin >> w[i];
    v.push_back({w[i], i});
  }
  sort(v.begin(), v.end());
  cin >> s1;
  map<long long int, long long int> ans;
  long long int in = 1, ex = 0;
  priority_queue<long long int> q;
  for (auto x : v) {
  }
  for (long long int i = 0; i < s1.size(); i++) {
    if (s1[i] == '0') {
      ans[i + 1] = v[in - 1].second;
      q.push(in);
      in++;
    } else {
      k = q.top();
      q.pop();
      ans[i + 1] = v[k - 1].second;
    }
  }
  for (long long int i = 1; i < 2 * n + 1; i++) {
    cout << ans[i] << " ";
  }
}
