#include <bits/stdc++.h>
using namespace std;
vector<long long> tree;
void build(vector<long long> &arr, long long ind, long long l, long long r) {
  if (l == r) {
    tree[ind] = arr[l];
    return;
  }
  long long mid = (l + r) / 2;
  build(arr, ind * 2, l, mid);
  build(arr, ind * 2 + 1, mid + 1, r);
  tree[ind] = max(tree[ind * 2], tree[ind * 2 + 1]);
}
long long getMax(long long ind, long long tl, long long tr, long long l,
                 long long r) {
  if (l > r) return 0;
  if (l == tl && r == tr) return tree[ind];
  long long tm = (tl + tr) / 2;
  long long a = getMax(ind * 2, tl, tm, l, min(r, tm));
  long long b = getMax(ind * 2 + 1, tm + 1, tr, max(l, tm + 1), r);
  return max(a, b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  set<pair<long long, long long> > intr;
  set<pair<long long, long long> > extr;
  for (int i = 0; i < n; i++) {
    long long w;
    cin >> w;
    intr.insert({w, i + 1});
  }
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      auto p = *intr.begin();
      cout << p.second << " ";
      intr.erase(p);
      extr.insert(p);
    } else {
      auto p = *extr.rbegin();
      cout << p.second << " ";
      extr.erase(p);
    }
  }
  return 0;
}
