#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  map<int, int> emp;
  map<int, int> zan;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    emp[a[i]] = i + 1;
  }
  string b;
  cin >> b;
  for (int i = 0; i < b.length(); ++i) {
    if (b[i] == '0') {
      cout << emp.begin()->second << ' ';
      zan[emp.begin()->first] = emp.begin()->second;
      emp.erase(emp.begin());
    } else {
      auto s = zan.end();
      --s;
      cout << s->second << ' ';
      zan.erase(s);
    }
  }
  return 0;
}
