#include <bits/stdc++.h>
long long int power(long long int x, long long int b) {
  long long int p = 1;
  while (b > 0) {
    if (b & 1) {
      p = p * x;
      p %= 1000000007;
    }
    b >>= 1;
    x *= x;
    x %= 1000000007;
  }
  return p % 1000000007;
}
using namespace std;
void print(priority_queue<pair<long long int, long long int>,
                          vector<pair<long long int, long long int> >,
                          greater<pair<long long int, long long int> > >
               S) {
  while (!S.empty()) {
    cout << S.top().second << " ";
    S.pop();
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  priority_queue<pair<long long int, long long int>,
                 vector<pair<long long int, long long int> >,
                 greater<pair<long long int, long long int> > >
      S1;
  priority_queue<pair<long long int, long long int> > S2;
  for (long long int i = 0; i < n; i++) {
    long long int w;
    cin >> w;
    S1.push({w, i + 1});
  }
  string s;
  cin >> s;
  for (long long int i = 0; i < s.length(); i++) {
    if (s[i] == '0') {
      S2.push(S1.top());
      cout << S1.top().second << " ";
      S1.pop();
    } else {
      cout << S2.top().second << " ";
      S2.pop();
    }
  }
  return 0;
}
