| MITIT Winter 2025-26 Beginner Round |
|---|
| Finished |
Busy Beaver lines up $$$N$$$ marbles numbered $$$1$$$ through $$$N$$$, where the $$$i$$$-th marble shows a number $$$p_i \neq i$$$, and every number from $$$1$$$ to $$$N$$$ appears exactly once among $$$p_1, \dots, p_N$$$ (more formally, $$$p$$$ is a permutation over $$$1, \dots, N$$$ such that $$$p_i \neq i$$$).
He wants to paint the marbles so that each marble $$$i$$$ has a different color from marble $$$p_i$$$. However, he only has three colors: red, green, and blue. Help him find any valid painting.
The first line contains a single integer $$$T$$$ ($$$1 \leq T \leq 10^4$$$) — the number of test cases.
The first line of each test case contains one integer $$$N$$$ ($$$2 \le N \le 10^5$$$) — the number of marbles.
The second line of each test case contains $$$N$$$ integers $$$p_1, p_2, \dots, p_N$$$ ($$$1 \le p_i \le N$$$; $$$p_i \ne i$$$) — the numbers on the marbles. These numbers form a rearrangement of the numbers $$$1, \dots, N$$$ in some order.
The sum of $$$N$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, output a string of length $$$N$$$ containing the characters $$$\texttt{R}$$$, $$$\texttt{G}$$$, and $$$\texttt{B}$$$, where the $$$i$$$-th character denotes the color (red, green, or blue, respectively) of the $$$i$$$-th marble, satisfying the constraints.
If there are multiple possible answers, you can output any of them. We have a proof that under these constraints, an answer always exists.
552 1 5 3 462 1 4 3 6 552 3 4 5 133 1 244 3 2 1
GBBGR BGGRRB RBRBG RGB BRGG
In the first test case, the coloring $$$\texttt{GBBGR}$$$ works as follows:
| Name |
|---|


