The most valuable figure
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.
Input The first line contains the number of test cases (1 ≤ t ≤ 10). Each test case consists of two lines. Its first line contains the number of white figures (1 ≤ n ≤ 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: K – King, Q – Queen, R – Rook, B – Bishop, N – Knight, P – Pawn. White figures always are placed from the bottom (on the horizontal lines 1 and 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.
Output
For each test case in a separate line, print the name of the desired figure ("Queen", if it's Queen, "Rook", if the Rook, "Bishop", if the elephant, "Knight", if the Knight, "Pawn", if the Pawn). If none of your figures is beaten, print "NONE". Inscriptions show without the quotes!