#include <bits/stdc++.h>
using namespace std;
#define TR(i,v)         for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i)
#define DEBUG(x)        cout << #x << " = " << x << endl;
#define SIZE(p)         (int)(p).size()
#define MP(a, b)        make_pair((a), (b))
#define ALL(p)          (p).begin(), (p).end()
#define rep(i, n)       for(int (i)=0; (i)<(int)(n); ++(i))
#define REP(i, a, n)    for(int (i)=(a); (i)<(int)(n); ++(i))
#define FOR(i, a, b)    for(int (i)=(int)(a); (i)<=(int)(b); ++(i))
#define FORD(i, b, a)   for(int (i)=(int)(b); (i)>=(int)(a); --(i))
#define CLR(x, y)       memset((x), (y), sizeof((x)))
typedef long long LL;
typedef pair<int, int> pii;
typedef double NUM;
const double eps = 1e-10;
const double PI = acos(-1);
const double TWO_PI = 2*PI;
inline int dcmp(NUM x)   {
    return abs(x)<eps ? 0 : x<0 ? -1 : 1;
}
inline double zero(double x) {
    return dcmp(x)==0 ? 0 : x;
}
struct Point {
    NUM x, y;
    Point(NUM xx=0, NUM yy=0):    x(xx), y(yy)    {}    
};
typedef Point Vector;
typedef vector<Point> Polygon;
Vector operator+(Vector A, Vector B)        {return Vector(A.x+B.x, A.y+B.y);}
Vector operator-(Point A, Point B)          {return Vector(A.x-B.x, A.y-B.y);}
NUM Dot(Vector A, Vector B)                 {return A.x*B.x + A.y*B.y;}                     //计算两个向量之间的点积
double Length(Vector A)                     {return sqrt(Dot(A,A));}                        //计算向量的模
NUM Cross(Vector A, Vector B)               {return A.x*B.y - A.y*B.x;}                     //计算两个向量之间的叉积
double distanceToLine(Point P, Point A, Point B) {
    Vector v1=B-A, v2=P-A;
    return abs(Cross(v1,v2))/Length(v1);
}
double ang[3],CL[3];
Vector dir[3];
Point P[3];
double Rand(double s=1) {
	return rand()*1.0/RAND_MAX*s;
}
double calc(Point p) {
	double res=0;
	rep(i,3) {
		double d=distanceToLine(p,P[i],P[i]+dir[i]);
		res+=(CL[i]+0.2)*d*d;
	}
	return res;
}
Point solve() {
	Point sol=Point(Rand(),Rand());
	double L=10;
	while(dcmp(L-0.001)>0) {
		double ang=Rand(PI+PI);
		Point nxt=Point(sol.x+L*cos(ang),sol.y+L*sin(ang));
		double c1=calc(sol), c2=calc(nxt);
		if(dcmp(c2-c1)<0)	sol=nxt;
		L*=0.97;
	}
	return sol;
}
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
    freopen("UVA.in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    // ios::sync_with_stdio(false);		cin.tie(0);
    P[0]=Point(0,0),P[1]=Point(3.715,1.761),P[2]=Point(2.894,-2.115);
    int T;	scanf("%d", &T);
    while(T--) {
    	int cs;	scanf("%d",&cs);
    	rep(i,3)	scanf("%lf%lf",ang+i,CL+i);
    	rep(i,3)	ang[i]=ang[i]/180*PI, ang[i]=PI+PI-ang[i], ang[i]+=PI/2, dir[i]=Vector(cos(ang[i]),sin(ang[i]));
    	Point res=solve();
    	printf("%d %.3f %.3f\n",cs,res.x,res.y);
    }
    return 0;
}