import java.io.*; import java.util.Scanner; class Main{ static final InputStream in=System.in; static final PrintWriter out=new PrintWriter(System.out); static final int INF=Integer.MAX_VALUE; public static void main(String[] args){ Scanner sc=new Scanner(in); String line=""; double x=0.0; double y=0.0; double rx=0.0; double ry=0.0; int num=sc.nextInt(); while(num-->0){ for(int i=0;i<6;i++){ x=sc.nextDouble(); y=sc.nextDouble(); if(x>=0&&y>=0&&x>rx) rx=x; ry=y; } out.printf("%.10f\r\n",Math.toDegrees(Math.acos(rx))); } out.flush(); } }