The game of 31

Problem Name:
The game of 31
Site:Spoj
Links:
Tags:
Problem setters: