#include <bits/stdc++.h>
using namespace std;
typedef int def;
pair<int, int> Intro[200001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  stack<int> Extro;
  int n;
  cin >> n;
  for (def i = 0; i < (n); i++) {
    cin >> Intro[i].first;
    Intro[i].second = i + 1;
  }
  sort(Intro, Intro + n);
  int cnt = 0;
  for (def i = 0; i < (2 * n); i++) {
    char c;
    cin >> c;
    if (c == '0') {
      Extro.push(Intro[cnt].second);
      cout << Intro[cnt++].second << " ";
    } else {
      cout << Extro.top() << " ";
      Extro.pop();
    }
  }
}
