Problems
The most valuable figure
The most valuable figure
\includegraphics{https://static.e-olymp.com/content/55/556574cbaa964adb4c6882bd687831e198bdf2f3.jpg}
The problem of the relative strength and value of particular groups of figures are constantly occurs in the chess game, when there is the question of exchanges. In chess theory the values of figures are measured in pawns. Examples of relationships: Pawn = 1 Knight = 4, elephant = 4, Rook = 5 Queen = 9. You play the "white" and expect to move an opponent. Now it is important for you only one thing - what is most valuable of your figures, he can kill. It is guaranteed that the answer is always unambiguous.
\textbf{Input} The first line contains the number of test cases (\textbf{1} ≤ \textbf{t} ≤ \textbf{10}). Each test case consists of two lines. Its first line contains the number of white figures (\textbf{1} ≤ \textbf{n} ≤ \textbf{16}), followed by a single space determines their position on the board, as shown in the example. The second line of each test case in the same format describes the black pieces. Marking: \textbf{K} -- King, \textbf{Q} -- Queen, \textbf{R} -- Rook, \textbf{B} -- Bishop, \textbf{N} -- Knight, \textbf{P} -- Pawn. White figures always are placed from the bottom (on the horizontal lines \textbf{1} and \textbf{2}). It is guaranteed that the input data is correct and that is really could have place in our life. We also know that none of the Kings is beaten.
\OutputFile
For each test case in a separate line, print the name of the desired figure ("\textbf{Queen}", if it's Queen, "\textbf{Rook}", if the Rook, "\textbf{Bishop}", if the elephant, "\textbf{Knight}", if the Knight, "\textbf{Pawn}", if the Pawn). If none of your figures is beaten, print "\textbf{NONE}". Inscriptions show without the quotes!
Input example #1
1 8 Ka1 Rc1 Rh5 Nb1 Pa2 Pb3 Pc2 Pg3 8 Kg8 Qe3 Rf8 Ba5 Pd7 Pe7 Pf7 Ph7
Output example #1
Rook