spoj#BCHOCO. Breaking Chocolates
Breaking Chocolates
Bored of setting problems for Bytecode, Venkatesh and Akhil decided to take some time off and started to play a game. The game is played on an R*C bar of chocolate consisting of Black and White chocolate cells. Both of them do not like black chocolate, so if the bar consists only of black chocolate cells, it is discarded (Discarding the bar is not considered as a move). If the bar consists only of white chocolate cells, they do not break it further and the bar can be consumed at any time (Eating the bar is considered as a move). If the bar consists of both black and white chocolate cells, it must be broken down into two smaller pieces by breaking the bar along any horizontal or vertical line (Breaking the bar is considered as a move). The player who cannot make a move on any of the remaining bars loses.
Assuming Venkatesh starts the game and both players are infinitely intelligent, determine who wins the game.
Input
The first line of input contains a number 't', the number of test cases.
For each testcase, first line contains two space separated integers 'R' and 'C'. The following R lines contain C space separated integers which are either 0 (White) or 1 (Black).
Output
For each testcase output âVenkatesh winsâ or âAkhil winsâ (quotes for clarity).
Example
Input: 4 3 3 0 0 0 0 0 0 0 0 0 3 3 1 1 1 1 1 1 1 1 1 1 2 1 0 3 3 1 0 1 0 1 0 0 0 1</p>Output: Venkatesh wins Akhil wins Akhil wins Venkatesh wins
Explanation:
Case 1: Venkatesh can win in one move by eating all the 0's, which is the only move possible.</p>Case 2: The initial bar consists only of Black chocolate cells, so it has to be discarded. So no move is possible in the game.
Case 3: Venkatesh is forced to cut the bar into two. Now Akhil can eat the White chocolate cell and the black cell is discarded.
Constraints:
t <= 25 1 <= R, C <= 30