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.util.*;
import java.io.*;
import java.lang.*;
import java.rmi.dgc.Lease;

// Problem - Multiples of 3 onn codeforces MNedium difficulty level 
// or check on youtube channel CodeNCode

public class Problem {
     static int Mod = 1000000007;
    static long dp[][];
    static int g[][];
    static int fact[];


    public static void main(String[] args) {
        MyScanner scan = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
         int t = scan.nextInt();
        // int t = 1;
        while (t-- > 0) {
           int n= scan.nextInt();
           int p[]= new int[n];
           for(int i=0;i<n;i++){
               p[i]= scan.nextInt();
           }
           char c[]= scan.nextLine().toCharArray();
           int z=0;
           int o=0;
         
            ArrayList<Integer> list1= new ArrayList<>();
            Map<Integer,Integer> map1= new HashMap<>();
            ArrayList<Integer> list2= new ArrayList<>();
            Map<Integer,Integer> map2= new HashMap<>();
           
            for(int i=0;i<n;i++){
                if(c[i]=='0'){ z++;
                    list1.add(p[i]);
                }else{
                     o++;
                     list2.add(p[i]);
                }
            }

            Collections.sort(list1);
            Collections.sort(list2);
int k=0;
            for(int i=0;i<list1.size();i++){
                map1.put(list1.get(i),++k);
            }
            for(int i=0;i<list2.size();i++){
                map2.put(list2.get(i),++k);
            }

            for(int i=0;i<n;i++){
                if(map1.containsKey(p[i])) out.print(map1.get(p[i])+" ");
                else out.print(map2.get(p[i])+" ");
            }

            out.println();



        


            

        }

        out.close();
    }

 



    static ArrayList<Integer> digits(long n){
        ArrayList<Integer> list= new ArrayList<>();
        while(n>0){
            list.add((int)(n%10l));
            n=n/10l;
        }
        Collections.reverse(list);
        return list;
    }

    
    int upper_bound(long[] arr, int key) {
        int i=0, j=arr.length-1;
        if (arr[j]<=key) return j+1;
        if(arr[i]>key) return i;
        while (i<j){
            int mid= (i+j)/2;
            if(arr[mid]<=key){
                i= mid+1;
            }else{
                j=mid;
            }
        }
        return i;
    }

    static class Pair {
        int l;
        int r;

        Pair(int l, int r) {
            this.l = l;
            this.r = r;
        }

        @Override
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + l;
            result = prime * result + r;
            return result;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null)
                return false;
            if (getClass() != obj.getClass())
                return false;
            Pair other = (Pair) obj;
            if (l != other.l)
                return false;
            if (r != other.r)
                return false;
            return true;
        }

        @Override
        public String toString() {
            return "Pair [l=" + l + ", r=" + r + "]";
        }

    }

    public static void reverse(int a[]) {
        int n = a.length;
        for (int i = 0; i < n / 2; i++) {
            int temp = a[i];
            a[i] = a[n - i - 1];
            a[n - i - 1] = temp;
        }
    }

    public static void sort(int[] array) {
        ArrayList<Integer> copy = new ArrayList<>();
        for (Integer i : array)
            copy.add(i);
        Collections.sort(copy);
        for (int i = 0; i < array.length; i++)
            array[i] = copy.get(i);
    }

    public static void sort(long[] array) {
        ArrayList<Long> copy = new ArrayList<>();
        for (Long i : array)
            copy.add(i);
        Collections.sort(copy);
        for (int i = 0; i < array.length; i++)
            array[i] = copy.get(i);
    }

    public static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b); // gcd(a,b) = gcd(a-b,b) or gcd(a,b) = gcd(b,a%b) where a>b
    }

    public static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b); // gcd(a,b) = gcd(a-b,b) or gcd(a,b) = gcd(b,a%b) where a>b
    }

    public static long lcm(long a, long b) {
        return (a / gcd(a, b)) * b;
    }

    static long power(long x, long y) {
        long temp;
        if (y == 0) // a^b= (a^b/2)^2 if b is even
            return 1; // = (a*a^(b-1)) if b is odd
        temp = power(x, y / 2);
        if (y % 2 == 0)
            return temp * temp;
        else
            return x * temp * temp;
    }

    static long mod(long x) {
        return ((x % Mod + Mod) % Mod);
    }

    static long add(long a, long b) {
        return mod(mod(a) + mod(b));
    }

    static int mod(int x) {
        return ((x % Mod + Mod) % Mod);
    }

    static int add(int a, int b) {
        return mod(mod(a) + mod(b));
    }

    static int sub(int a, int b) {
        return mod(mod(a) - mod(b) + Mod);
    }

    static long mul(long a, long b) {
        return mod(mod(a) * mod(b));
    }

    static long pow(long x, long y, long p) {
        long res = 1; // Initialize result
        x = x % p; // Update x if it is more than or equal to p

        if (x == 0)
            return 0; // In case x is divisible by p;

        while (y > 0) {
            // If y is odd, multiply x with result
            if ((y & 1) != 0)
                res = (res * x) % p;

            // y must be even now
            y = y >> 1; // y = y/2
            x = (x * x) % p;
        }
        return res;
    }

    static long modInverse(long a, long m) {
        // int g = gcd(a, m);
        // if (g != 1)
        // System.out.println("Inverse doesn't exist");
        // else {
        // // If a and m are relatively prime, then modulo
        // // inverse is a^(m-2) mode m
        // return power(a, m - 2, m);
        // }
        return pow(a, m - 2, m);
    }

}

class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }

}
