Game

For each pair of positive integers A and B, decide who wins a subtraction game where a player may subtract any positive multiple of the smaller number from the larger, or take the remainder modulo the smaller.

Medium7Game theoryMathNo attempts yetTime limit0.1sMemory limit1024 MB

Problem

Mirek likes playing with numbers. He plays the following game with his friend Kamil.

A game starts with two non-negative integers AA and BB. Assume ABA \le B. The players take turns, and on a turn a player makes one of these two moves.

  • Replace BB with BAKB-AK. The player can pick any integer KK with K>0K>0 and BAK0B-AK \ge 0.
  • Replace BB with BmodAB \bmod A.

If BAB \le A, the same moves are available with the roles of the two numbers swapped. The player who turns either number into 00 wins. Mirek always moves first.

Both players play optimally. For each game, determine whether Mirek or Kamil wins.

Input

The first line contains the number of games TT (1T1041 \le T \le 10^4). Each of the next TT lines describes one game and contains two integers AA and BB (1A,B10181 \le A, B \le 10^{18}).

Output

Print TT lines. Line ii contains the name of the winner of the ii-th game, either Mirek or Kamil.