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.
1
7
1 2 3 4 5 6 7
0101010
 3
2
1 2
10
7
1 2 3 4 5 6 7
0101010
8
2 3 1 8 5 4 7 6
01110001
 1
50
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
10101010101010101010101010101010101010101010101010

1 5 2 6 3 7 4
 2 1
1 5 2 6 3 7 4
1 6 5 8 3 2 4 7
 26 1 27 2 28 3 29 4 30 5 31 6 32 7 33 8 34 9 35 10 36 11 37 12 38 13 39 14 40 15 41 16 42 17 43 18 44 19 45 20 46 21 47 22 48 23 49 24 50 25

import java.io.*;
import java.util.*;

public class Main {
    class JoinSet {
        int[] fa;
        JoinSet(int n){
            fa = new int[n];
            for(int i = 0;i < n;i++) fa[i] = i;
        }
        int find(int x){
            if(x != fa[x]) fa[x] = find(fa[x]);
            return fa[x];
        }
        void join(int x, int y){
            x = find(x);
            y = find(y);
            fa[x] = y;
        }
    }
    static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
    static int mod = (int)1e9+7;
    static boolean[] isprime=new boolean[1];
    static {
        for(int i=2;i<isprime.length;i++) isprime[i]=true;
        for(int i=2;i<isprime.length;i++) {
            if(isprime[i]) {
                for(int k = 2; i*k<isprime.length; k++) {
                    isprime[i*k] = false;
                }
            }
        }
    }
    public static long gcd(long a, long b){
        return b == 0 ? a : gcd(b,a%b);
    }
    public static long lcm(long a, long b){
        return a*b / gcd(a,b);
    }
    public static int get() throws Exception{
        String ss = bf.readLine();
        if (ss.contains(" ")) ss = ss.substring(0, ss.indexOf(" "));
        return Integer.parseInt(ss);
    }
    public static int[] getInt() throws Exception {
        String s[] = bf.readLine().split(" ");
        int[] a = new int[s.length];
        for(int i = 0;i < a.length;i++){
            a[i] = Integer.parseInt(s[i]);
        }
        return a;
    }
    public static long[] getLong() throws Exception {
        String s[] = bf.readLine().split(" ");
        long[] a = new long[s.length];
        for(int i = 0;i < a.length;i++){
            a[i] = Long.parseLong(s[i]);
        }
        return a;
    }
    public static void print(int[] a) throws Exception {
        for(int i : a){
            bw.write(i + " ");
        }
        println();
    }
    public static void print(long[] a) throws Exception {
        for(long i : a){
            bw.write(i + " ");
        }
        println();
    }
    public static void print(String a) throws Exception {
        bw.write(a+"\n");
    }
    public static void print(long a) throws Exception {
        bw.write(a+"\n");
    }
    public static void print(int a) throws Exception {
        bw.write(a + "\n");
    }
    public static void println() throws Exception{
        bw.write("\n");
    }
    public static long pow(long a, long b){
        long ans = 1;
        while(b > 0){
            if((b&1) == 1){
                ans *= a;
            }
            a*=a;
            b>>=1;
        }
        return ans;
    }
    public static int powmod(long a, long b, int mod){
        long ans = 1;
        while(b > 0){
            if((b&1) == 1){
                ans = ans * a % mod;
            }
            a = a * a % mod;
            b>>=1;
        }
        return (int)ans;
    }
    public static void sort(int[] a){
        int n = a.length;
        Integer[] b = new Integer[n];
        for(int i = 0;i < n;i++) b[i] = a[i];
        Arrays.sort(b);
        for(int i = 0;i < n;i++) a[i] = b[i];
    }

    public static void main(String[] args) throws Exception {
        int t = get();
        while (t-- > 0){
            int n = get();
            int[] a = getInt();
            int ans[] = new int[n];
            String s = bf.readLine();
            int c = 0;
            for(int i = 0;i < n;i++){
                if(s.charAt(i) == '1') c++;
            }
            if(c == n || c == 0) print(a);
            else {
                int x[] = new int[c];
                int y[] = new int[n - c];
                int k1 = 0, k2 = 0;
                for (int i = 0; i < n; i++) {
                    if (s.charAt(i) == '1') x[k1++] = a[i];
                    else y[k2++] = a[i];
                }
                sort(x);
                sort(y);
                int b[] = new int[n];
                for (int i = 0; i < c; i++) b[x[i] - 1] = i;
                for (int i = 0; i < n - c; i++) b[y[i] - 1] = i;
                for (int i = 0; i < n; i++) {
                    if (s.charAt(i) == '1') ans[i] = n-c + 1 + b[a[i] - 1];
                    else ans[i] = 1 + b[a[i] - 1];
                }
                print(ans);
            }
        }
        bw.flush();
    }
}