Submit Solution(Code Jam Page)
### Problem

### Input

### Output

### Limits

#### Small dataset

#### Large dataset

### Sample

A short, short time into the future, in a nearby galaxy, you find yourself wanting to take a little trip and get away from the responsibilities of being Planet Thundera's only manufacturer of yarn. You decide to travel to Planet Care-a-Lot, the most relaxing planet there is. To travel, you are going to use the network of interstellar teleporters.

A teleporter is a small machine floating around somewhere in space. You can
use it remotely from any point in space, but, due to the conservation of
teleportation distance principle, it can teleport you to any other point in
space at exactly the same L1 distance from the teleporter as your
L1 distance to it before the teleportation. The L1 distance between two points
at coordinates (x_{0}, y_{0}, z_{0}) and
(x_{1}, y_{1}, z_{1}) is given by
|x_{0} - x_{1}| + |y_{0} - y_{1}|
+ |z_{0} - z_{1}|. Unfortunately, your space jetpack is broken,
so you cannot move around on your own; to travel, you can only use the
teleporters.
You start at Planet Thundera. You can use a teleporter to travel from Planet
Thundera to a point p_{1}, then use another to get from p_{1}
to p_{2}, and so on. The last teleportation must take you exactly to
Planet Care-a-Lot.

Given the locations in 3-dimensional space of both planets and all the available teleporters, find out if it is possible for you to make the trip using only teleporters. If the trip can be made, what is the minimum number of teleportations needed to get to your destination? (Even if two teleportations use the same teleporter, they still count as separate teleportations.)

The input is given as points with coordinates that are all integers that fall within a certain range. However, you are allowed to teleport to intermediate points with integer or non-integer coordinates, and there are no range restrictions on the points you can visit.

The first line of the input gives the number of test cases, **T**.
**T** test cases follow. Each test case starts with a single line with a
single integer **N**, the number of teleporters available. Then,
**N**+2 lines follow, each containing three integers **X _{i}**,

For each test case, output one line containing `Case #x: y`

, where
`x`

is the test case number (starting from 1) and `y`

is `IMPOSSIBLE`

if it is not possible to get from Thundera to
Care-A-Lot using only the available teleporters, or, if it is possible, an
integer representing the minimum number of teleportations needed.

1 ≤ **T** ≤ 100.

(**X _{i}**,

1 ≤ **N** ≤ 100.

-10^{3} ≤ **X _{i}** ≤ 10

-10

-10

1 ≤ **N** ≤ 150.

-10^{12} ≤ **X _{i}** ≤ 10

-10

-10

Input |
Output |

3 1 0 0 0 0 4 0 0 3 0 2 0 0 1 0 0 11 0 0 3 0 0 0 3 0 0 0 6 2 0 6 0 0 3 0 0 6 1 0 |
Case #1: IMPOSSIBLE Case #2: 3 Case #3: 2 |

In Sample Case #1, the only teleporter is exactly 3 units away from Thundera,
and we can only use it to go to another position that is *exactly* 3
units away from the teleporter. From that position, we can still only reach
other positions that are exactly 3 units away from the teleporter. Since
Care-a-Lot is 1 unit away from the teleporter, we can never reach it.

In Sample Case #2, the optimal strategy is to first use the teleporter at (0, 0, 3) to travel to (0, 0, 5). Then, from there, use the teleporter at (0, 0, 0) to travel to (0, 0, -5). Finally, from there, use the teleporter at (0, 0, 3) again to travel to (0, 0, 11). Note that the two uses of the teleporter at (0, 0, 3) cause us to travel different distances, because we are at different distances from the teleporter each time. Also note that the two uses of that teleporter count as two separate teleportations.

In Sample Case #3, the optimal strategy is to first use the teleporter at (3, 0, 0) to travel to (6, 0, 0). Then, from there, use the teleporter at (6, 1, 0) to travel to (6, 2, 0). Note that even though there was a teleporter at (6, 0, 0), merely occupying the same point as a teleporter does not count as using it.