Nahida is investigating a new chess piece she invented called the K-Knight! In one move, the K-Knight moves one square in one direction, and at least
Nahida has an infinite 2-D board, and she denotes the square on the
To make sure you know what you're doing, Nahida will reset time and play the game with you
Constraints
Input Specification
The first line contains
Each of the next
Output Specification
For each game, output the minimum number of moves it will take to reach square -1
.
Sample Input
3
1 4 3
7 2 3
0 0 100
Sample Output
2
3
0
Comments