#include <bits/stdc++.h>
using namespace std;
struct myhash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
long long modpow(long long base, long long exp, long long modulus) {
  base %= modulus;
  long long result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
long long modinv(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
bool sorter(pair<long long, long long> x, pair<long long, long long> y) {
  return x.second > y.second;
}
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<pair<long long, long long> > seats(n);
  for (long long(i) = (0); i < (n); ++(i)) {
    long long x;
    cin >> x;
    seats[i] = make_pair(i + 1, x);
  }
  sort(seats.begin(), seats.end(), sorter);
  stack<long long> st1;
  for (long long(i) = (0); i < (n); ++(i)) {
    st1.push(seats[i].first);
  }
  stack<long long> st;
  string s;
  cin >> s;
  for (long long(i) = (0); i < (s.length()); ++(i)) {
    if (s[i] == '0') {
      cout << st1.top() << " ";
      st.push(st1.top());
      st1.pop();
    } else {
      cout << st.top() << " ";
      st.pop();
    }
  }
  return 0;
}
