Saito Hajime is a ninja who must fight many opponents foolish enough to challenge his might. Most of them fall easily to his martial arts, but from time to time Saito faces a particularly powerful and skilled foe. Such a foe appears only after dozens of lesser minions have already been defeated, and the duel always takes place in an empty rectangular room.
To defeat such a foe, Saito performs a special technique called the Zero Stance Ultimate Finishing Strike. He launches a flying kick from his current position. A single kick is not enough against a powerful foe, but Saito can build up power by bouncing off the walls before he lands the hit. Every bounce makes the attack stronger, so with enough bounces any foe can be defeated. Whenever Saito bounces off a wall he obeys the rule that the angle of incidence equals the angle of reflection.
Saito knows exactly how many times he must bounce off the walls to defeat a given foe. He must be careful, though: if the strike takes too long the foe might dodge it, so the total distance Saito travels must be as short as possible.
Given the room, Saito's starting position, the foe's position, and the required number of bounces, determine how many times Saito hits each of the four walls during the shortest possible strike.
The first line contains a single integer: the number of test cases. Each test case consists of three lines:
The bottom-left corner of the room is at $(0, 0)$; the north wall lies in the positive $y$-direction and the east wall in the positive $x$-direction. Saito and the foe never start at the same position. If Saito hits a corner of the room, it counts as two bounces, one for each of the two walls that meet there. Saito may fly over the foe while performing the strike.
For each test case, output: