#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, j = 0, temp;
  cin >> n;
  string s;
  pair<int, int> my;
  vector<pair<int, int>> v(n);
  queue<pair<int, int>> q;
  stack<pair<int, int>> st;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    v[i].first = temp;
    v[i].second = i;
  }
  sort(v.begin(), v.end());
  cin >> s;
  for (int i = 0; i < n; i++) {
    q.push(v[i]);
  }
  for (int i = 0; i < (2 * n); i++) {
    if (s[i] == '0') {
      my = q.front();
      cout << my.second + 1 << " ";
      q.pop();
      st.push(my);
    } else {
      cout << (st.top()).second + 1 << " ";
      st.pop();
    }
  }
  return 0;
}
