#include <bits/stdc++.h>
using namespace std;
const long long Inf = 1e9 + 5;
const long long MaxN = 1e5 + 5;
const long long Min = -MaxN;
const bool standart = true;
vector<int> g[MaxN];
int used[MaxN];
int sum[MaxN];
int n, m, cnt;
void Debug() {}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  if (!standart) {
    freopen(
        "File"
        ".in",
        "r", stdin);
    freopen(
        "File"
        ".out",
        "w", stdout);
  }
  int n;
  cin >> n;
  priority_queue<pair<int, int>> q;
  pair<int, int> pr[n];
  for (int i = 0; i < n; i++) {
    cin >> pr[i].first;
    pr[i].second = i + 1;
  }
  string s;
  cin >> s;
  sort(pr, pr + n);
  ;
  int intr = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      cout << pr[intr].second;
      q.push(pr[intr]);
      intr++;
    } else {
      cout << q.top().second;
      q.pop();
    }
    cout << " ";
  }
  return 0;
}
