#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? '1' : '0'); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ",";
  _print(v...);
}
long long int temp, temp1, temp2, temp3;
long long int ceiling(long long int y, long long int x) {
  if (y < 0) {
    return 9223372036854775807 - 1e6;
  }
  temp3 = y + x - 1;
  temp3 /= x;
  return temp3;
}
void solveC() {
  long long int n, k;
  cin >> n >> k;
  vector<long long> v(n);
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
  }
  if (sum <= k) {
    cout << "0\n";
    return;
  }
  sort(v.begin(), v.end());
  long long int search2 = sum;
  long long int ans = sum - k;
  for (long long int i = n - 1; i >= 1; i--) {
    search2 -= (v[i] - v[0]);
    if (search2 <= k) {
      ans = min(ans, n - i);
    }
  }
  long long int p = 0;
  for (long long int i = n - 1; i >= 1; i--) {
    temp = n - i;
    p += v[i];
    temp1 = ceiling(sum - p + v[0] * temp - k, temp + 1);
    ;
    ans = min(ans, temp1 + temp);
  }
  cout << ans << '\n';
}
void solveB() {
  long long int n;
  cin >> n;
  vector<long long> v(n), ans(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  string s;
  cin >> s;
  long long int zcnt = 0;
  vector<long long> tobe0, tobe1;
  for (long long int i = 0; i < n; i++) {
    char u = s[i];
    if (u == '0') {
      zcnt++;
      tobe0.push_back(i);
    } else {
      tobe1.push_back(i);
    }
  }
  vector<pair<long long, long long>> v1(zcnt), v2(n - zcnt);
  for (long long int i = 0; i < zcnt; i++) {
    v1[i] = {v[tobe0[i]], tobe0[i]};
  }
  for (long long int i = zcnt; i < n; i++) {
    v2[i - zcnt] = {v[tobe1[i - zcnt]], tobe1[i - zcnt]};
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  ;
  ;
  for (long long int i = 0; i < zcnt; i++) {
    ans[v1[i].second] = i + 1;
  }
  for (long long int i = 0; i < n - zcnt; i++) {
    ans[v2[i].second] = zcnt + i + 1;
  }
  for (long long int i = 0; i < n; i++) {
    cout << ans[i] << ' ';
  }
  cout << '\n';
}
void solveA() {
  long long int A[3];
  for (long long int i = 0; i < 3; i++) {
    cin >> A[i];
  }
  sort(A, A + 3);
  bool q = 0;
  if (A[1] == A[0]) {
    q |= (!((A[2]) & 1));
  }
  if (A[1] == A[2]) {
    q |= (!((A[0]) & 1));
  }
  q |= (A[2] == A[1] + A[0]);
  if (q) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solveB();
  }
  return 0;
}

### Prompt

In Cpp, your task is to solve the following problem:

Berland Music is a music streaming service built specifically to support Berland local artist. Its developers are currently working on a song recommendation module.

So imagine Monocarp got recommended n songs, numbered from 1 to n. The i-th song had its predicted rating equal to p_i, where 1 ≤ p_i ≤ n and every integer from 1 to n appears exactly once. In other words, p is a permutation.

After listening to each of them, Monocarp pressed either a like or a dislike button. Let his vote sequence be represented with a string s, such that s_i=0 means that he disliked the i-th song, and s_i=1 means that he liked it.

Now the service has to re-evaluate the song ratings in such a way that:

  * the new ratings q_1, q_2, ..., q_n still form a permutation (1 ≤ q_i ≤ n; each integer from 1 to n appears exactly once); 
  * every song that Monocarp liked should have a greater rating than every song that Monocarp disliked (formally, for all i, j such that s_i=1 and s_j=0, q_i>q_j should hold). 



Among all valid permutations q find the one that has the smallest value of ∑_{i=1}^n |p_i-q_i|, where |x| is an absolute value of x.

Print the permutation q_1, q_2, ..., q_n. If there are multiple answers, you can print any of them.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of testcases.

The first line of each testcase contains a single integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the number of songs.

The second line of each testcase contains n integers p_1, p_2, ..., p_n (1 ≤ p_i ≤ n) — the permutation of the predicted ratings.

The third line contains a single string s, consisting of n characters. Each character is either a 0 or a 1. 0 means that Monocarp disliked the song, and 1 means that he liked it.

The sum of n over all testcases doesn't exceed 2 ⋅ 10^5.

Output

For each testcase, print a permutation q — the re-evaluated ratings of the songs. If there are multiple answers such that ∑_{i=1}^n |p_i-q_i| is minimum possible, you can print any of them.

Example

Input


3
2
1 2
10
3
3 1 2
111
8
2 3 1 8 5 4 7 6
01110001


Output


2 1
3 1 2
1 6 5 8 3 2 4 7

Note

In the first testcase, there exists only one permutation q such that each liked song is rating higher than each disliked song: song 1 gets rating 2 and song 2 gets rating 1. ∑_{i=1}^n |p_i-q_i|=|1-2|+|2-1|=2.

In the second testcase, Monocarp liked all songs, so all permutations could work. The permutation with the minimum sum of absolute differences is the permutation equal to p. Its cost is 0.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? '1' : '0'); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ",";
  _print(v...);
}
long long int temp, temp1, temp2, temp3;
long long int ceiling(long long int y, long long int x) {
  if (y < 0) {
    return 9223372036854775807 - 1e6;
  }
  temp3 = y + x - 1;
  temp3 /= x;
  return temp3;
}
void solveC() {
  long long int n, k;
  cin >> n >> k;
  vector<long long> v(n);
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
  }
  if (sum <= k) {
    cout << "0\n";
    return;
  }
  sort(v.begin(), v.end());
  long long int search2 = sum;
  long long int ans = sum - k;
  for (long long int i = n - 1; i >= 1; i--) {
    search2 -= (v[i] - v[0]);
    if (search2 <= k) {
      ans = min(ans, n - i);
    }
  }
  long long int p = 0;
  for (long long int i = n - 1; i >= 1; i--) {
    temp = n - i;
    p += v[i];
    temp1 = ceiling(sum - p + v[0] * temp - k, temp + 1);
    ;
    ans = min(ans, temp1 + temp);
  }
  cout << ans << '\n';
}
void solveB() {
  long long int n;
  cin >> n;
  vector<long long> v(n), ans(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  string s;
  cin >> s;
  long long int zcnt = 0;
  vector<long long> tobe0, tobe1;
  for (long long int i = 0; i < n; i++) {
    char u = s[i];
    if (u == '0') {
      zcnt++;
      tobe0.push_back(i);
    } else {
      tobe1.push_back(i);
    }
  }
  vector<pair<long long, long long>> v1(zcnt), v2(n - zcnt);
  for (long long int i = 0; i < zcnt; i++) {
    v1[i] = {v[tobe0[i]], tobe0[i]};
  }
  for (long long int i = zcnt; i < n; i++) {
    v2[i - zcnt] = {v[tobe1[i - zcnt]], tobe1[i - zcnt]};
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  ;
  ;
  for (long long int i = 0; i < zcnt; i++) {
    ans[v1[i].second] = i + 1;
  }
  for (long long int i = 0; i < n - zcnt; i++) {
    ans[v2[i].second] = zcnt + i + 1;
  }
  for (long long int i = 0; i < n; i++) {
    cout << ans[i] << ' ';
  }
  cout << '\n';
}
void solveA() {
  long long int A[3];
  for (long long int i = 0; i < 3; i++) {
    cin >> A[i];
  }
  sort(A, A + 3);
  bool q = 0;
  if (A[1] == A[0]) {
    q |= (!((A[2]) & 1));
  }
  if (A[1] == A[2]) {
    q |= (!((A[0]) & 1));
  }
  q |= (A[2] == A[1] + A[0]);
  if (q) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solveB();
  }
  return 0;
}

```