#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  int n;
  cin >> n;
  map<int, pair<int, int> > seats;
  map<int, int> index;
  int w[n];
  for (int i = 0; i < n; ++i)
    cin >> w[i], seats[w[i]] = {0, 0}, index[w[i]] = i + 1;
  string s;
  cin >> s;
  sort(w, w + n);
  stack<int> cur;
  int low = 0, tmp;
  for (int i = 0; i < 2 * n; ++i) {
    if (s[i] == '0') {
      seats[w[low]].first = 1;
      cout << index[w[low]] << " ";
      cur.push(w[low++]);
    } else {
      tmp = cur.top();
      cur.pop();
      cout << index[tmp] << " ";
    }
  }
}
