The MITIT club regularly hosts "social mixers", which are fun events meant for club members to socialize and take a break from schoolwork, problem writing, or contest organization. Snacks and games are provided. But the games can be a little weird...
Amy and Aimee, members of the MITIT club, are playing a new board game they invented!
The board consists of a row of $$$N$$$ squares, each colored either red, green, or white. The players have also agreed on a parameter $$$K$$$ (satisfying $$$0 \le K \le \min(N-1, 7)$$$), which is a nonnegative integer. Amy goes first and they take turns.
In each turn, the player makes a move following the below procedure:
In particular, it is always acceptable for $$$S$$$ to have exactly one white cell, and it is never possible for $$$|S|$$$ to exceed $$$K + 1$$$ (of course, $$$|S|$$$ must be odd as well).
The first player unable to make a legal move loses.
Given the state of the board before Amy makes her first move, with no red squares adjacent to green squares, determine which player will win if both play optimally.
The input consists of several test cases. The first line contains an integer $$$T$$$ ($$$1 \le T \le 5 \cdot 10^4$$$): the number of test cases.
The first line of each test case contains $$$N$$$ and $$$K$$$ ($$$1 \le N \le 2\cdot 10^5$$$, $$$\mathbf{0 \le K \le \min(N-1, 7)}$$$).
The second line of each test case contains a string of $$$N$$$ characters describing the initial state of the board. Each character is either R (red), G (green), or W (white). It is guaranteed that no R is adjacent to a G.
It is guaranteed that the sum of $$$N$$$ over all test cases does not exceed $$$4 \cdot 10^5$$$.
For each test case, output either Amy or Aimee, indicating the player who will win.
55 4WWWWW16 3RRRRWGGGGGWRRRRR6 5WWWWWW12 0WWWWRRWGGGWW13 7WRRWWGWRWRWWW
Amy Aimee Aimee Amy Amy
In the first sample test case, Amy can win by choosing $$$S$$$ to be the entire board and coloring it all red on her first turn.
In the second sample, Amy cannot make a legal move on her first turn, and she loses immediately.
In the third sample, no matter what Amy does on her first move, Aimee is always able to color the entire board with the same color on her turn, thus winning the game.