#include <bits/stdc++.h>
using namespace std;
int n, width[200050], sol[200050];
string str;
set<int> empty_row, half_row;
unordered_map<int, int> width_to_index;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> width[i];
    empty_row.insert(width[i]);
    width_to_index[width[i]] = i + 1;
  }
  for (int i = 0; i < 2 * n; i++) {
    char att;
    cin >> att;
    if (att == '0') {
      sol[i] = width_to_index[*empty_row.begin()];
      half_row.insert(*empty_row.begin());
      empty_row.erase(empty_row.begin());
    } else {
      sol[i] = width_to_index[*(--half_row.end())];
      half_row.erase(--half_row.end());
    }
  }
  for (int i = 0; i < 2 * n; i++) cout << sol[i] << " ";
  return 0;
}
