import math T = int(input()) eps = 10**(-12) for t in range(T): blank = input() x, y = 1, 0 for i in range(6): xi, yi = map(float, input().split()) if xi > 0.5 and yi >= - eps: x, y = xi, yi print(180 * math.atan2(x, y) / math.pi)