The neighborhood kids invented another odd game. Everybody runs back and forth inside a marked field, and nobody may turn at will: every step goes straight along one of the four compass directions.
The field is a grid of M columns and N rows. A position is a pair (x,y) with 0≤x<M and 0≤y<N, and (0,0) is the bottom-left corner. A step N raises y by one, a step S lowers y by one, a step E raises x by one, and a step W lowers x by one.
The rules are as follows.
John finds the game silly, because the starting layout already settles the outcome. Write the program that works out the winner for him, so he can show the other kids and talk them into playing something better.
The figure below shows the starting layout of the first sample game.

The first line holds the number of games T. Each game is given as follows.
The first line of a game holds three integers M, N, and P: the width of the field, its height (both counted in squares), and the number of players.
Each of the next P lines holds a name, the x and y coordinates of that player's starting square, and the direction the player faces at the start, separated by spaces. The direction is one of N, S, E, and W. No two players start on the same square, and the player listed first is "it".
The last line of a game holds the number of rounds R.
Constraints:
For each game print one line reading Case x: name, where x is the number of the game counting from 1 and name is the winner's name.