#include <bits/stdc++.h>
using namespace std;
class Triple {
 public:
  long long int index;
  long long int width;
  Triple() {
    index = 0;
    width = 0;
  }
};
bool compare(class Triple const& a, class Triple const& b) {
  return a.width < b.width;
}
int main() {
  long long int n;
  cin >> n;
  Triple tri[n];
  string order;
  stack<long long int> seated;
  vector<long long int> solution;
  for (int i = 0; i < n; ++i) {
    cin >> tri[i].width;
    tri[i].index = i;
  }
  cin >> order;
  sort(tri, tri + n, compare);
  int count = 0;
  for (int i = 0; i < 2 * n; ++i) {
    if (order[i] == '0') {
      solution.push_back(tri[count].index + 1);
      seated.push(tri[count].index);
      count++;
    } else if (order[i] == '1') {
      long long int last = seated.top();
      seated.pop();
      solution.push_back(last + 1);
    }
  }
  for (auto& i : solution) {
    cout << i << " ";
  }
  return 0;
}
