Ultimate Finishing Strike#3128

Ultimate Finishing Strike

1 second
32 megabytes
Hard

As a ninja, Saito Hajime has to fight many opponents who are foolish enough to challenge his might. Most of these opponents fall easily to Saito's great martial arts techniques and ninjitsus (A ninjitsu is a technique that comes from the ninja's inner power called Q_i.) From time to time, however, Saito Hajime has to face a particularly powerful and skilled foe. This foe usually enters the combat after several dozens of his or her minions have been defeated by Saito. Saito always encounters such foes in empty rectangular rooms.

In order to defeat such a powerful foe, Saito must perform a special ninjitsu known as Saito Hajime's Zero Stance Ultimate Finishing Strike. This strike involves hitting his foe with a flying kick that starts at Saito's current position. Of course, a simple flying kick will not be enough to defeat a powerful foe, but Saito can enhance the power of his strike by bouncing off several walls before hitting his foe. Every bounce gives his attack more power, so with enough bounces, any foe can be defeated. Note that Saito always bounces off a wall according to the rule "angle of incidence is equal to angle of reflection."

Saito knows how many times he has to bounce off a wall to defeat a particular foe. However, he must be careful: if his attack takes too long, his foe might manage to dodge it. Therefore, the distance traveled by Saito while performing his strike must be as short as possible. Can you determine how many times Saito will hit each of the four walls while performing his strike?

Input

The first line of input contains a single number: the number of test cases to follow. Each test case is given in the following format:

  • A line with three positive integers , (3 \leq L; W \leq 100), and (0 \leq B \leq 10^5): the length and width of the room, and the number of bounces necessary to defeat the foe.

  • A line with two positive integers x_S (0 < x_S < L) and y_S (0 < y_S < W): the starting coordinates of Saito.

  • A line with two positive integers x_f (0 < x_f < L) and y_f (0 < y_f < W): the coordinates of the foe.

The bottom left corner of the room is at . You can assume that Saito and his foe do not start in the same position. If Saito hits a corner of the room, it counts as two bounces, one for each wall. Saito may also fly over his foe while performing his strike.

Output

For each test case in the input, output the following:

  • One line with four integers: the number of times Saito hits the north, east, south, and west wall, respectively. The north wall is in the positive -direction and the east wall is in the positive -direction. If there are several possible ways, output all of them in lexicographic order, each on its own line.

  • One line containing the number .

Examples

Example 1

Loading
Loading