Darts

Time limit1sMemory limit128 MB

Problem

A dartboard is a circular board centered at the origin. It is divided by concentric circles with radii 3cm, 6cm, 9cm, 12cm, and 15cm. From the center outward, the regions are worth 100, 80, 60, 40, and 20 points. A dart landing outside the 15cm radius scores 0 points.

Two players each throw three darts in turn. A player's score is the sum of the scores of the three regions hit by their darts. Assume that all darts thrown by the first player are removed before the second player throws.

If a dart lands exactly on a boundary between two regions, it receives the higher score.

For each test case, compute both players' scores and print the winner or a tie. Double precision floating-point arithmetic is sufficient for coordinate and distance calculations.

Input

The first line contains the number of test cases T.

Each test case is given on one line with 12 real numbers. Every pair of numbers is the coordinate (x, y) of one dart hit, in centimeters. The first three coordinates are the first player's darts, and the next three coordinates are the second player's darts.

All coordinates satisfy -20.0 <= x, y <= 20.0.

Output

For each test case, print one line.

If there is a winner, print the line in this format:

SCORE: N to M, PLAYER P WINS.

If the game is tied, print the line in this format:

SCORE: N to M, TIE.

N is the first player's score, M is the second player's score, and P is the winning player number, either 1 or 2. All scores are nonnegative integers.