#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v;
stack<long long> ex;
vector<long long> ans;
long long a, n;
string s;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    v.push_back(make_pair(a, i + 1));
  }
  cin >> s;
  sort(v.begin(), v.end());
  for (int i = 0, p = 0; i < s.size(); ++i) {
    if (s[i] == '0') {
      ex.push(v[p].second);
      ans.push_back(v[p].second);
      p++;
    } else {
      ans.push_back(ex.top());
      ex.pop();
    }
  }
  for (int i = 0; i < 2 * n; ++i) {
    cout << ans[i] << " ";
  }
  return 0;
}
