#include <bits/stdc++.h>
using namespace std;
template <typename T>
void dbg(T a) {}
template <typename T, typename... Arg>
void dbg(T a, Arg... arg) {}
const int maxn = (1e6) + 7;
const int inf = (1e9) + 7;
const long long LLinf = (1e18) + 7;
const long double eps = 1e-9;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int> > V;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    V.push_back({-a, i});
  }
  sort(V.begin(), V.end());
  string s;
  cin >> s;
  set<pair<int, int> > zb;
  for (auto v : s) {
    if (v == '0') {
      cout << V.back().second << " ";
      zb.insert({V.back().first, V.back().second});
      V.pop_back();
    } else {
      cout << zb.begin()->second << " ";
      zb.erase(*(zb.begin()));
    }
  }
  return 0;
}
