import sys from math import acos, pi def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def lcm(a, b): return a * b // gcd(a, b) def solve(): T = int(input()) eps = 10**(-12) for i in range(T): input() xt = -1 for j in range(6): x, y = map(float, input().split()) if y >= -eps and x >= -eps: xt = max(x, xt) if abs(xt - 1) <= eps: xt = 1.0 elif abs(xt) <= eps: xt = 0.0 ans = acos(xt) / pi * 180.0 print(ans) if __name__ == '__main__': solve()