#include <bits/stdc++.h>
using namespace std;
const long long lt = 100005;
long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<pair<long long, long long> > w;
  long long i, val;
  for (i = 0; i < n; i++) {
    cin >> val;
    w.push_back(make_pair(val, i + 1));
  }
  sort(w.begin(), w.end());
  string s;
  cin >> s;
  long long j;
  set<long long> x;
  j = 0;
  for (i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      cout << w[j].second << " ";
      x.insert(j);
      j++;
    } else {
      auto it = x.end();
      it--;
      long long k = (*it);
      x.erase(it);
      cout << w[k].second << " ";
    }
  }
  cout << endl;
  return 0;
}
