#include <bits/stdc++.h>
using namespace std;
void func(deque<int> q, char c) {}
int main() {
  int n;
  cin >> n;
  deque<int> q;
  pair<int, int> p[n];
  for (int i = 0; i < n; i++) {
    int f;
    cin >> f;
    p[i].first = f;
    p[i].second = i + 1;
  }
  sort(p, p + n);
  for (int i = 0; i < n; i++) {
    q.push_back(p[i].second);
  }
  string s;
  cin >> s;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      int v = q.front();
      q.pop_front();
      q.push_back(v);
      cout << v << " ";
    } else if (s[i] == '1') {
      cout << q.back() << " ";
      q.pop_back();
    }
  }
}
