import math n = int(raw_input()) for loop in range(n): raw_input() XY = [map(float,raw_input().split()) for _ in range(6)] XY = [[x,y] for x,y in XY if y >= 0] XY = sorted(XY,reverse = True) x,y = map(float,("%.12f %.12f"%(XY[0][0],XY[0][1])).split()) deg = math.acos((2.0-((1.0-x)**2+(0.0-y)**2))/2.0)*180/math.pi if deg > 59.999999: deg = abs(60.0-deg) print "%.7f"%deg