The Stone Game
InterviewTime limit1sMemory limit128 MB
Players alternately remove 1 to K of N stones, and the player taking the last stone wins each test case.
- Level
Easy3 of 10
- Topics
- Game theory, Math
- Solved
- No attempts yet
Problem
Hektor and Wiktor play a simple game.
There are stones on the table. Starting with Hektor, the players take turns removing between and stones from the table. The player who removes the last stone wins.
Who wins if neither player ever makes a mistake?
Here, "not making a mistake" means always choosing a move that guarantees a win whenever such a move exists.
Input
The first line contains the number of test sets ().
The descriptions of the sets follow. Each set consists of a single line with two natural numbers and ().
Output
For each set, print on its own line the name of the player who wins that game. The name is either Hektor or Wiktor.