def solve(): for _ in range(6): a,b = map(float,input().split()) if 0.1 < a < 0.9 and 0.1 < b < 0.9: x = acos(a)*180/pi if x >= 52: x -= 60 ans = x return ans from math import acos,pi n = int(input()) for i in range(n): input() print(solve())