#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, x, c;
vector<pair<int, int>> v;
vector<int> ans;
stack<int> se;
string s;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    v.push_back({x, i});
  }
  sort(v.begin(), v.end());
  cin >> s;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '0') {
      ans.push_back(v[c].second);
      se.push(v[c].second);
      c++;
    } else {
      int t = se.top();
      ans.push_back(t);
      se.pop();
    }
  }
  for (int i = 0; i < 2 * n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
