#include <bits/stdc++.h>
using namespace std;
priority_queue<long long, vector<long long> > ex;
priority_queue<long long, vector<long long>, greater<long long> > in;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long ans[2 * n];
  map<long long, long long> m;
  long long x;
  for (int i = 0; i < n; i++) cin >> x, m[x] = i + 1, in.push(x);
  string str;
  cin >> str;
  for (int i = 0; i < 2 * n; i++) {
    if (str[i] == '1') {
      long long temp = ex.top();
      ex.pop();
      ans[i] = m[temp];
    } else {
      long long temp = in.top();
      in.pop();
      ans[i] = m[temp];
      ex.push(temp);
    }
  }
  for (int i = 0; i < 2 * n; i++) cout << ans[i] << " ";
  return 0;
}
long long choose(long long n, long long k) {
  if (k == 0) return 1;
  return (n * choose(n - 1, k - 1)) / k;
}
bool isprime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int power(int x, int y, int p) {
  int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
