#include <bits/stdc++.h>
using namespace std;
struct hmin {
  bool operator()(const pair<int, int> &x, const pair<int, int> &y) {
    return x.first > y.first;
  }
};
struct hmax {
  bool operator()(const pair<int, int> &x, const pair<int, int> &y) {
    return x.first < y.first;
  }
};
int main() {
  cout << setprecision(10) << fixed;
  ios::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  vector<int> w(n);
  for (int i = 0; i < n; i++) cin >> w[i];
  priority_queue<pair<int, int>, vector<pair<int, int> >, hmin> h1;
  priority_queue<pair<int, int>, vector<pair<int, int> >, hmax> h2;
  for (int i = 0; i < n; i++) h1.push({w[i], i + 1});
  string s;
  cin >> s;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      cout << h1.top().second << ' ';
      h2.push(h1.top());
      h1.pop();
    } else {
      cout << h2.top().second << ' ';
      h2.pop();
    }
  }
  return 0;
}
