#include <bits/stdc++.h>
using namespace std;
int n;
string i;
int main() {
  int n;
  vector<int> v;
  stack<int> st;
  int F = 0;
  map<int, int> mp;
  int pq;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
    mp[tmp] = i + 1;
  }
  sort(v.begin(), v.end());
  int I = 0;
  for (int j = 0; j < 2 * n; ++j) {
    char ch;
    cin >> ch;
    if (ch == '0') {
      cout << mp[(int)v[I]] << " ";
      st.push(v[I]);
      ++I;
    } else {
      cout << mp[st.top()] << " ";
      st.pop();
    }
  }
}
