The box splitting game is played with two boxes.
At the start one box holds N stones and the other holds M stones. Two players take turns.
On your turn you choose one box and empty it completely. You then take the stones sitting in the other box and put them into the two boxes. Each of the two boxes must hold at least 1 stone afterwards.
The player who leaves exactly 1 stone in each box wins the game.
Given N and M, write a program that finds the winner when both players play the game perfectly.