#K75967. Arrange Band Members

    ID: 34537 Type: Default 1000ms 256MiB

Arrange Band Members

Arrange Band Members

In a band, the members belong to one of two groups: group A and group B. The manager wants to rearrange the band members so that all members of group A come before all members of group B.

For each test case, you are given the number of band members N and a list of single-character strings representing each band member (either 'A' or 'B'). Your task is to output the rearranged list where all 'A's appear first, followed by all 'B's.

Note: Let \(N_A\) be the count of members from group A and \(N_B\) be the count from group B such that \(N_A + N_B = N\).

inputFormat

The input is read from standard input (stdin) and is structured as follows:

  1. The first line contains an integer T, the number of test cases.
  2. For each test case, the first line contains an integer N, the number of band members.
  3. The second line contains N space-separated uppercase letters ('A' or 'B') representing the band members.

outputFormat

For each test case, output a single line containing the rearranged band members such that all 'A's come before all 'B's. The members should be separated by a single space.

## sample
1
5
A B A B A
A A A B B

</p>