URI Online Judge | 3162

# Space Communication

By Daniel Lago, CEFET-MG Brazil

Timelimit: 1

The year is 2337. Thousands of human crews travel in space in a crazy way to and fro. And the best: the ships can communicate via radio, it is even possible for crews between different ships to play games.

However, unfortunately the signal quality fades with distance. While nearby ships are able to communicate well, ships that are distant have poor signal strength to communicate. For this reason, the ships preferentially communicate with the nearest ship.

Considering a stretch of space where the ships can be considered points in space, therefore with three-dimensional coordinates, with each axis being able to have a value between 0 and 100 m.u. It is known that the intensity of the communication signal is given by the distance between the ships; so that ships that are spaced up to 20 m.u. have a high intensity; above 20 m.u. and up to 50 m.u. have a medium intensity; while the signal strength above 50 m.u. it is so low that it does not allow communication between ships.

Given the information passed on, help the crew of these ships to be able to know the signal strength between each of them and the nearest ship, to inform them if they will be able to have good communication with each other.

## Input

The first line of the entry has an integer N (2 <= N <= 10), which represents the number of ships in the space to be analyzed. The next N lines will receive 3 integer values, separated by space, indicating the discrete x, y and z coordinates of each ship.

## Output

One line for each ship, indicating a letter for the signal strength between it and the nearest ship. "A" stands for high intensity; "M" represents medium intensity and "B" represents low intensity.

 Input Sample Output Sample 4 50 55 55 15 28 79 45 48 37 25 50 32 A B A M