import math def str2float(x): thresh = 14 if x[0] == "-": thresh += 1 xs = x[0:thresh] if set(xs.replace("-","").replace(".","")) == set("0"): return 0.0 else: return float(xs) def solver(): x0 = 0 y0 = 0 for i in range(6): x, y = map(str2float, input().split(" ")) if (x > 0 and y >= 0) and (x > x0): x0 = x y0 = y if y == 0.0: x0 = 1.0 return math.acos(x0)*180.0/math.pi T = int(input()) ans = [] for i in range(T): input() ans.append(solver()) for i in ans: print(i)