#include using namespace std; typedef long long ll; typedef double D; typedef complex P; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) const double EPS = 1e-9; const int MOD = 1000000007; int main(){ int T; cin >> T; REP(t,T){ P p[6]; double x,y; REP(i,6){ cin >> x >> y; p[i] = P(x,y); } double minv = 360.; REP(i,6){ double a = arg(p[i])*180/3.14159265358979323; if(a > -EPS){ minv = min(minv, a); } } cout << fixed << setprecision(16) << minv << endl; } return 0; }