#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<pair<int, int>> w(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    pair<int, int> p;
    p.first = x;
    p.second = i;
    w[i] = p;
  }
  sort(w.begin(), w.end());
  int ind = 0, curr = 0;
  string s;
  cin >> s;
  vector<int> ans;
  stack<int> st;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      ans.push_back(w[curr].second + 1);
      st.push(w[curr].second + 1);
      curr++;
    } else {
      ans.push_back(st.top());
      st.pop();
    }
  }
  for (int i = 0; i < 2 * n; i++) cout << ans[i] << " ";
  cout << endl;
}
