import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int T = sc.nextInt(); for(int tt = 0; tt < T; tt++){ final int size = 6; double[] xs = new double[size]; double[] ys = new double[size]; for(int i = 0; i < size; i++){ xs[i] = sc.nextDouble(); ys[i] = sc.nextDouble(); } double min = Double.MAX_VALUE; for(int i = 0; i < size; i++){ double x = xs[i] + 1; double y = ys[i]; if(Math.abs(x) < 1e-12 && Math.abs(y) < 1e-12){ x = 0; y = -1; } min = Math.min(min, Math.toDegrees(Math.atan2(y, x))); //System.out.println(x + " " + y + " => " + Math.toDegrees(Math.atan2(y, x))); } System.out.printf("%.10f\n", 180 + min * 2); } } }