Mirek likes playing with numbers. He plays the following game with his friend Kamil.
A game starts with two non-negative integers A and B. Assume A≤B. The players take turns, and on a turn a player makes one of these two moves.
- Replace B with B−AK. The player can pick any integer K with K>0 and B−AK≥0.
- Replace B with BmodA.
If B≤A, the same moves are available with the roles of the two numbers swapped. The player who turns either number into 0 wins. Mirek always moves first.
Both players play optimally. For each game, determine whether Mirek or Kamil wins.