#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, m, x, y, i, j, ans = 0, c = 0, sum = 0;
  string s;
  cin >> n;
  std::vector<pair<long long int, long long int>> v(n);
  for (i = 0; i < n; i++) {
    cin >> v[i].first;
    v[i].second = i + 1;
  }
  sort(v.begin(), v.end());
  cin >> s;
  stack<long long int> st;
  long long int curr = 0;
  for (i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      st.push(v[curr].second);
      cout << v[curr].second << " ";
      curr++;
    }
    if (s[i] == '1') {
      cout << st.top() << " ";
      st.pop();
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
