## Yet Another Contest 5 P2 - Big Score

View as PDF

Points: 10 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Josh, Nils, and Mike are on a heist!

They have already broken into different banks. Each bank has three rooms, and each room in the -th bank contains an array of vaults. Originally, the -th vault in all three rooms contained the same number of treasures.

Josh, Nils, and Mike coordinated their heist, so for every bank, each person went to a different room and performed exactly moves on the vaults, where is a positive integer (that may differ depending on the bank). However, despite their planning, each person made different types of moves.

• In one move, Josh took exactly two treasures from vault and put one treasure into vault , where .

• In one move, Nils took exactly two treasures from vault and put one treasure into vault , where .

• In one move, Mike took either one or two treasures from any vault , where .

Of course, the number of treasures taken from a vault in one move could not exceed the number of treasures already in that vault.

Knowing this and given the final states of each vault inside of each room, can you help figure out which person broke into which room for each bank? Note that since they disabled the security cameras, you do not know the value of .

#### Constraints

It is guaranteed that each vault initially had no more than treasures.

It is guaranteed that the input is valid. (Originally, , and each person performed valid moves described above on a different array of vaults.)

The sum of across all banks will not exceed .

For every move, Mike is guaranteed to have removed two treasures.

#### Input Specification

The first line contains an integer .

The next lines contain information on the banks. For each bank, the first line contains an integer .

The second line contains integers , representing the final state of the vaults inside the first room.

The third line contains integers , representing the final state of the vaults inside the second room.

The fourth line contains integers , representing the final state of the vaults inside the third room.

#### Output Specification

For each bank, on a separate line, output the names Josh, Nils, and Mike in an order corresponding to who broke into the first, second and third rooms respectively. If there are multiple possible valid orders, output any of them.

#### Sample Input

2
5
4 4 0 7 3
3 6 2 6 0
4 7 2 5 0
2
999999999 0
0 999999999
666666666 0

#### Sample Output

Nils Mike Josh
Josh Nils Mike

#### Explanation

Originally, the treasures inside the vaults of each room in bank were , and each person performed moves.

In the first room, Nils took two treasures from vault and put one treasure back in vault , took two treasures from vault and put one treasure back in vault , then took two treasures from vault and put one treasure back in vault .

In the second room, Mike took one treasure from vault , took two treasures from vault , then took one more treasure from vault .

In the third room, Josh took two treasures from vault and put one treasure back in vault , took two more treasures from vault and put one treasure back in vault once again, then took two treasures from vault and put one treasure back in vault .