#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > seats;
vector<int> anti;
vector<int> opti;
vector<int> answer;
vector<int> tarstalan;
int main() {
  int n;
  cin >> n;
  seats.resize(n);
  answer.resize(n * 2);
  tarstalan.clear();
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    seats[i].push_back(temp);
    seats[i].push_back(i);
  }
  sort(seats.begin(), seats.end());
  string s;
  cin >> s;
  for (int i = 0; i < n * 2; i++) {
    if (s[i] == '1') {
    } else {
      anti.push_back(i);
    }
  }
  for (int i = 0; i < n; i++) {
    int a = anti[i];
    int c = seats[i][1];
    answer[a] = c + 1;
  }
  for (int i = 1; i < n * 2; i++) {
    if (s[i] == '0' && s[i - 1] == '0') {
      tarstalan.push_back(i - 1);
    } else if (s[i] == '1') {
      if (s[i - 1] == '0') {
        answer[i] = answer[i - 1];
      } else {
        answer[i] = answer[tarstalan[tarstalan.size() - 1]];
        tarstalan.pop_back();
      }
    }
  }
  for (int i = 0; i < n * 2; i++) {
    cout << answer[i] << " ";
  }
  return 0;
}
