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.math.*;

public class Main {
    // ArrayList<Integer> al = new ArrayList<>();
    // ArrayList<Pair<Integer, Integer>> al = new ArrayList<>();
    // Set<Integer> set = new TreeSet<>();
    // Pair<Integer, Integer> pair;
    // Map<Integer, Integer> map = new HashMap<>();
    // LinkedList<Integer> ll = new LinkedList<>();
    // for(Map.Entry<Integer,Integer> e:map.entrySet())pn(e.getKey()+"
    // "+e.getValue());

    // *********************** Code Begins From Here*************************

    public static void solve() {
        int n = c.i(), a[] = c.intArray(n), A[] = new int[n];
        char s[] = c.next().toCharArray();
        ArrayList<Pair<Integer, Integer>> al = new ArrayList<>();
        ArrayList<Pair<Integer, Integer>> bl = new ArrayList<>();
        for (int i = 0; i < n; i++)
            if (s[i] == '1')
                al.add(new Pair(a[i], i));
            else
                bl.add(new Pair(a[i], i));
        Collections.sort(al);
        Collections.sort(bl);
        // pn(al);
        // pn(bl);
        if (al.size() == n || bl.size() == n) {
            watch(a);
            return;
        }
        int val = 1;
        for (Pair<Integer, Integer> e : bl) {
            A[e.second] = val++;
        }
        for (Pair<Integer, Integer> e : al) {
            A[e.second] = val++;
        }
        watch(A);
    }

    public static void main(String[] args) throws FileNotFoundException {
        c = new FastScanner();
        pw = new PrintWriter(System.out);
        int tc = 1;
        tc = c.i();
        long start = System.currentTimeMillis();
        // sieve(10000000);
        // for (long i = 0; i < arr.length; i++) {
        // if (arr[(int) i]) {
        // primes.add(i);
        // }
        // }

        for (int t = 0; t < tc; t++) {
            // p("Case #" + (t + 1) + ": ");
            solve();
        }
        long end = System.currentTimeMillis();
        if (System.getProperty("os.name").equals("Mac OS X")) {
            pn("The Program takes " + (end - start) + "ms");
        }
        pw.close();
    }

    // math util
    private static int lower(int a[], int x) {
        int l = 0, r = a.length - 1, mid, ans = 0;
        while (l <= r) {
            mid = l + ((r - l) >> 1);
            if (a[mid] <= x) {
                ans = max(ans, mid);
                l = mid + 1;
            } else
                r = mid - 1;
        }
        return ans;
    }

    private static int upper(int a[], int x) {
        int l = 0, r = a.length - 1, mid, ans = -1;
        while (l <= r) {
            mid = l + ((r - l) >> 1);
            if (a[mid] >= x) {
                ans = mid;
                r = mid - 1;
            } else
                l = mid + 1;
            // pn(l + " " + mid + " " + r);
        }
        return ans;
    }

    private static int cei(double d) {
        return (int) Math.ceil(d);
    }

    private static long ceil(double d) {
        return (long) Math.ceil(d);
    }

    private static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    private static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    private static int lcm(int a, int b) {
        return a * b / gcd(a, b);
    }

    private static int abs(int a, int b) {
        return (int) Math.abs(a - b);
    }

    private static int abs(int a) {
        return (int) Math.abs(a);
    }

    private static long abs(long a) {
        return (long) Math.abs(a);
    }

    private static long abs(long a, long b) {
        return (long) Math.abs(a - b);
    }

    private static int max(int a, int b) {
        if (a > b) {
            return a;
        } else {
            return b;
        }
    }

    private static int min(int a, int b) {
        if (a > b) {
            return b;
        } else {
            return a;
        }
    }

    private static long max(long a, long b) {
        if (a > b) {
            return a;
        } else {
            return b;
        }
    }

    private static long min(long a, long b) {
        if (a > b) {
            return b;
        } else {
            return a;
        }
    }

    private static int pow(int base, int exp) {
        int result = 1;
        while (exp != 0) {
            if ((exp & 1) == 1)
                result *= base;
            exp >>= 1;
            base *= base;
        }
        return result;
    }

    private static long powerMod(long base, long exp, long mod) {
        long result = 1;
        base %= mod;
        while (exp > 0) {
            if ((exp & 1) != 0)
                result = (result * base) % mod;
            exp >>= 1;
            base = base * base % mod;
        }
        return result < 0 ? result + mod : result;
    }

    private static long addMod(long a, long b, long mod) {
        return (a % mod + b % mod) % mod;
    }

    private static long subMod(long a, long b, long mod) {
        return (a % mod - b % mod) % mod;
    }

    private static long mulMod(long a, long b, long mod) {
        return ((a % mod) * (b % mod)) % mod;
    }

    private static long pow(long base, long exp) {
        long result = 1;
        while (exp != 0) {
            if ((exp & 1) == 1)
                result = result * base;
            exp >>= 1;
            base *= base;
        }
        return result;
    }

    // array util
    private static void sortList(ArrayList<Integer> al) {
        Collections.sort(al);
    }

    private static void sortListP(ArrayList<Pair<Integer, Integer>> al) {
        Collections.sort(al);
    }

    private static void sort(int[] a) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int e : a)
            al.add(e);
        sortList(al);
        int i = 0;
        for (int e : al)
            a[i++] = e;
    }

    private static void sort(double[] a) {
        ArrayList<Double> al = new ArrayList<>();
        for (double e : a)
            al.add(e);
        Collections.sort(al);
        int i = 0;
        for (double e : al)
            a[i++] = e;
    }

    private static void sort(char[] a) {
        ArrayList<Character> al = new ArrayList<>();
        for (char e : a)
            al.add(e);
        Collections.sort(al);
        int i = 0;
        for (char e : al)
            a[i++] = e;
    }

    private static void sort(long[] a) {
        ArrayList<Long> al = new ArrayList<>();
        for (long e : a)
            al.add(e);
        Collections.sort(al);
        int i = 0;
        for (long e : al)
            a[i++] = e;
    }

    private static int[] copy(int[] a) {
        int[] ans = new int[a.length];
        for (int i = 0; i < a.length; ++i)
            ans[i] = a[i];
        return ans;
    }

    private static char[] copy(char[] a) {
        char[] ans = new char[a.length];
        for (int i = 0; i < a.length; ++i)
            ans[i] = a[i];
        return ans;
    }

    private static long[] copy(long[] a) {
        long[] ans = new long[a.length];
        for (int i = 0; i < a.length; ++i)
            ans[i] = a[i];
        return ans;
    }
    // output

    private static void pn(Object o) {
        pw.println(o);
    }

    private static void p(Object o) {
        pw.print(o);
    }

    private static void pry() {
        pn("Yes");
    }

    private static void pY() {
        pn("YES");
    }

    private static void prn() {
        pn("No");
    }

    private static void pN() {
        pn("NO");
    }

    private static void flush() {
        pw.flush();
    }

    private static void watch(int[] a) {
        for (int e : a)
            p(e + " ");
        pn("");
    }

    private static void watch(long[] a) {
        for (long e : a)
            p(e + " ");
        pn("");
    }

    private static void watch(char[] a) {
        for (char e : a)
            p(e + " ");
        pn("");
    }

    private static void watchList(ArrayList<Integer> al) {
        for (int e : al)
            p(e + " ");
        pn("");
    }

    private static Set<Integer> putSet(int[] a) {
        Set<Integer> set = new TreeSet<>();
        for (int e : a)
            set.add(e);
        return set;
    }

    private static boolean[] sieve(int n) {
        boolean[] isPrime = new boolean[n + 1];
        Arrays.fill(isPrime, true);
        isPrime[0] = false;
        isPrime[1] = false;
        for (int i = 2; i * i <= n; i++) {
            for (int j = i * i; j <= n; j += i) {
                isPrime[j] = false;
            }
        }
        return isPrime;
    }

    static void permute(String s, String answer, ArrayList<Long> al) {
        if (s.length() == 0) {
            al.add(Long.parseLong(answer));
            return;
        }

        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            String left_substr = s.substring(0, i);
            String right_substr = s.substring(i + 1);
            String rest = left_substr + right_substr;
            permute(rest, answer + ch, al);
        }
    }

    private static class Pair<U, V> implements Comparable<Pair<U, V>> {
        public final U first;
        public V second;

        public <U, V> Pair<U, V> makePair(U first, V second) {
            return new Pair<U, V>(first, second);
        }

        public Pair(U first, V second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) {
                return true;
            }
            if (o == null || getClass() != o.getClass()) {
                return false;
            }

            Pair pair = (Pair) o;

            return !(first != null ? !first.equals(pair.first) : pair.first != null)
                    && !(second != null ? !second.equals(pair.second) : pair.second != null);
        }

        @Override
        public int hashCode() {
            int result = first != null ? first.hashCode() : 0;
            result = 31 * result + (second != null ? second.hashCode() : 0);
            return result;
        }

        public Pair<V, U> swap() {
            return makePair(second, first);
        }

        @Override
        public String toString() {
            return "(" + first + "," + second + ")";
        }

        @SuppressWarnings({ "unchecked" })
        public int compareTo(Pair<U, V> o) {
            int value = ((Comparable<U>) first).compareTo(o.first);
            if (value != 0) {
                return value;
            }
            return ((Comparable<V>) second).compareTo(o.second);
        }
    }

    private static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() throws FileNotFoundException {

            if (System.getProperty("os.name").equals("Mac OS X")) {
                // Input is a file
                br = new BufferedReader(new FileReader("input.txt"));

                // PrintWriter class prints formatted representations
                // of objects to a text-output stream.
                PrintStream pw = new PrintStream(new FileOutputStream("output.txt"));
                System.setOut(pw);
            } else {
                // Input is System.in
                br = new BufferedReader(new InputStreamReader(System.in), 32768);
                st = null;
            }

        }

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

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

        int[] intArray(int n) {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++)
                ret[i] = i();
            return ret;
        }

        ArrayList<Integer> intList(int n) {
            ArrayList<Integer> al = new ArrayList<>();
            for (int i = 0; i < n; i++)
                al.add(i());
            return al;
        }

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

        long[] longArray(int n) {
            long[] ret = new long[n];
            for (int i = 0; i < n; i++)
                ret[i] = l();
            return ret;
        }

        double[] doubleArray(int n) {
            double[] ret = new double[n];
            for (int i = 0; i < n; i++)
                ret[i] = l();
            return ret;
        }

        ArrayList<Long> longList(int n) {
            ArrayList<Long> al = new ArrayList<>();
            for (int i = 0; i < n; i++)
                al.add(l());
            return al;
        }

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

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

    private static boolean arr[] = sieve(1000001);
    private static ArrayList<Long> primes = new ArrayList<>();
    private static int freq[] = new int[200005];
    private static int mod = (int) (1e9 + 7);
    private static final int IMAX = 2147483647;
    private static final int IMIN = -2147483648;
    private static final long LMAX = 9223372036854775807L;
    private static final long LMIN = -9223372036854775808L;
    private static FastScanner c;
    private static PrintWriter pw;
}