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 songs, numbered from to . The -th song had its predicted rating equal to , where and every integer from to appears exactly once. In other words, 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 , such that means that he disliked the -th song, and means that he liked it.
Now the service has to re-evaluate the song ratings in such a way that:
- the new ratings still form a permutation (; each integer from to appears exactly once);
- every song that Monocarp liked should have a greater rating than every song that Monocarp disliked (formally, for all such that and , should hold).
Among all valid permutations find the one that has the smallest value of , where is an absolute value of .
Print the permutation . If there are multiple answers, you can print any of them.
Input Format: The first line contains a single integer () — the number of testcases.
The first line of each testcase contains a single integer () — the number of songs.
The second line of each testcase contains integers () — the permutation of the predicted ratings.
The third line contains a single string , consisting of characters. Each character is either a or a . means that Monocarp disliked the song, and means that he liked it.
The sum of over all testcases doesn't exceed .
Output Format: For each testcase, print a permutation — the re-evaluated ratings of the songs. If there are multiple answers such that is minimum possible, you can print any of them.
Note: In the first testcase, there exists only one permutation such that each liked song is rating higher than each disliked song: song gets rating and song gets rating . .
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 . Its cost is .