#include <bits/stdc++.h>
using namespace std;
void pv(vector<long long> v, long long x) {
  for (int i = 0; i < x; i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}
long long x;
vector<pair<long long, long long> > w;
set<pair<long long, long long> > bse;
set<pair<long long, long long> > ose;
string s;
vector<long long> ans(400005);
int main() {
  long long test;
  test = 1;
  while (test--) {
    long long n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> x;
      w.push_back(make_pair(x, i + 1));
    }
    for (int i = 0; i < n; i++) {
      bse.insert(w[i]);
    }
    cin >> s;
    set<pair<long long, long long> >::iterator it;
    pair<long long, long long> temp;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '0') {
        it = bse.begin();
        temp = *it;
        ose.insert(make_pair((*it).first, (*it).second));
        bse.erase(it);
        ans[i] = (temp.second);
      } else {
        it = ose.end();
        it--;
        temp = *it;
        ose.erase(it);
        ans[i] = (temp.second);
      }
    }
    pv(ans, 2 * n);
  }
}
