Alice and Bob are playing a game on a permutation $$$p$$$ of length $$$n$$$, where $$$p$$$ contains each integer from $$$1$$$ to $$$n$$$ exactly once.
The game is played with a statue that can be placed on any position of the permutation. Initially, the statue is placed at position $$$x$$$. Alice moves first, and the players alternate turns.
On each turn, the current player can move the statue from its current position $$$i$$$ to any position $$$j$$$ (where $$$i \neq j$$$), but only if $$$p_i \geq p_k$$$ for all indices $$$k$$$ such that $$$\min(i, j) \leq k \leq \max(i, j)$$$.
The first player who cannot make any valid move loses the game.
Both Alice and Bob play optimally, meaning that at their turns they perform the best possible move. Due to this, the game becomes quite deterministic if you know the initial permutation $$$p$$$ and the initial position of the statue, $$$x$$$. In fact, for a given permutation $$$p$$$, we can figure out for each initial position $$$x$$$ whether Alice or Bob will win the game.
You are given a string $$$s$$$ of length $$$n$$$ consisting of letters A and B. Your task is to construct a permutation $$$p$$$ of length $$$n$$$ such that, for each position $$$x$$$, if the game starts with the statue at position $$$x$$$, the winner is Alice if the $$$x$$$-th character of the string is A, and Bob if it is B.
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases.
The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the length of the string.
The second line contains a string $$$s$$$ of length $$$n$$$ consisting only of characters A and B.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5000$$$.
For each test case, output a single line containing $$$n$$$ integers $$$p_1, p_2, \ldots, p_n$$$ — the permutation $$$p$$$ that satisfies the conditions.
If there are multiple possible permutations, output any one of them. If no such permutation exists, output $$$-1$$$ instead.
33BAB3AAA4BAAA
1 3 2 -1 1 2 3 4
| Name |
|---|


