#include <bits/stdc++.h>
using namespace std;
pair<int, int> s[200005];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i].first;
    s[i].second = i;
  }
  sort(s, s + n);
  stack<int> extro;
  int intro = 0;
  for (int i = 0; i < 2 * n; i++) {
    char c;
    cin >> c;
    if (c == '0') {
      cout << s[intro].second + 1 << " ";
      intro++;
      extro.push(s[intro - 1].second + 1);
    } else {
      int a = extro.top();
      extro.pop();
      cout << a << " ";
    }
  }
}
