#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  vector<pair<int, int>> v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back({x, i});
  }
  sort(v.begin(), v.end());
  int j = 0;
  set<pair<int, int>> ss;
  for (int i = 0; i < 2 * n; i++) {
    char c;
    cin >> c;
    if (c == '0') {
      cout << v[j].second + 1;
      ss.insert({v[j].first, v[j].second});
      j++;
    } else {
      auto it = ss.end();
      --it;
      cout << it->second + 1;
      ss.erase(it);
    }
    cout << " ";
  }
}
