Hi Codeforces community, I have tried to figured out the solution of this problem: http://codeforces.com/gym/101775/problem/L . However, I can't get the way to solve this problem. Maybe anyone knows the approach to solve this problem?

I know that game theory type problem often require to compute the grundy number. But as far as I know, computing the grundy number is just the identifier whether the state is losing state (grundy number = 0) or winning state (grundy number != 0). However, this problem required to output condition where the result may be a draw and I don't know what is the grundy number representation for a draw.

Maybe do anyone know how to compute the grundy number if the solution is computing the grundy number?

Thanks anyway!! Good day to you..