#GYM104720H. Cooking Timer

Cooking Timer

本题没有可用的提交语言。

Description

Timmy really likes observing the $N$ analog cooking clocks on the wall. Each of the $N$ analog clocks have three hands: hours $h(0\leq h < 24)$, minutes $m(0\leq m < 60)$, and seconds $s(0\leq s < 60)$. For each of the $N$ clocks, Timmy will say what the minimum angular difference between any two hands is, in degrees. Your job is to predict what Timmy will say.

The first line will contain $N (1\leq N\leq 10^5)$, the number of analog clocks. Each of the following $N$ lines will contain three integers: $h, m, s$, the current hour, minute, and second respectively shown on the clock.

On every new line print the degrees of the minimum angular difference between any two hands. Your answer will be treated as correct up to a difference of $10^{-6}$

Input

The first line will contain $N (1\leq N\leq 10^5)$, the number of analog clocks. Each of the following $N$ lines will contain three integers: $h, m, s$, the current hour, minute, and second respectively shown on the clock.

Output

On every new line print the degrees of the minimum angular difference between any two hands. Your answer will be treated as correct up to a difference of $10^{-6}$

5
12 0 0
1 2 3
2 3 4
3 4 5
4 5 6
0.000000000000000
5.700000000000000
5.600000000000000
5.500000000000000
5.400000000000000