They are given a positive integer P and a set A={a1,a2,…,aN} of N distinct nonnegative integers. Every ai is less than P.
The players take turns alternately. On each turn, the player to move deletes one number from A.
After exactly K turns, if the sum of the numbers remaining in A is divisible by P, X wins. Otherwise, Y wins.
Write a program that determines who wins when both players play optimally.
Input
The first line contains a positive integer T, the number of games in the input.
Then, for each i=0,1,…,T−1:
line 3i+2 contains N, K, and P, separated by spaces;
line 3i+3 contains a single character, X or Y, which is the player who moves first;
line 3i+4 contains a1,a2,…,aN, separated by spaces.
Output
Print one line with T characters and no separators, one character per game. The i-th character is X if X wins the i-th game no matter how Y plays, and Y otherwise.