#include <bits/stdc++.h>
using namespace std;

const double EPS = 1e-8;
const double PI = acos(-1.0);

struct point
{
	double x, y;
	point(){}
	point(double x, double y) : x(x), y(y){};
	point operator -(const point &rhs) const {
		return point(x - rhs.x, y - rhs.y);
	}
	double operator *(const point &rhs) const {
		return x * rhs.y - y * rhs.x;
	}
	double operator %(const point &rhs) const {
		return x * rhs.x + y * rhs.y;
	}
};

double sqr(double x)
{
	return x * x;
}

double sqr(point P)
{
	return sqr(P.x) + sqr(P.y);
}

double abs(point P)
{
	return sqrt(sqr(P));
}

double deg[3], CL[3];
point P[3] = {point(0.0, 0.0), point(3.715, 1.761), point(2.894, -2.115)};
point Q[3];

point intersect(point u1, point u2, point v1, point v2)
{
  point res = u1;
  double t = ((u1.x - v1.x) * (v1.y - v2.y) - (u1.y - v1.y) * (v1.x - v2.x))
            / ((u1.x - u2.x) * (v1.y - v2.y) - (u1.y - u2.y) * (v1.x - v2.x));
  res.x += (u2.x - u1.x) * t;
  res.y += (u2.y - u1.y) * t;
  return res;
}

double dist(point a, point b)
{
	return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
}

double dlc(point a, point b, point P)
{
	return abs((b - a) * (P - a)) / abs(b - a);
}

double calc(point now)
{
	double res = 0.0;
	for (int i = 0; i < 3; i++) {
		res += (CL[i] + 0.2) * sqr(dlc(P[i], Q[i], now));
	}
	return res;
}

void check(double x, double y, double &tx, double &ty, double &best)
{
	double delta = calc(point(x, y));
	if (delta < best) {
		best = delta;
		tx = x;
		ty = y;
	}
}

//FFF
point gao(point now)
{
	double x = now.x, y = now.y;
	double best = calc(now);
	double step = 1e3;
	while (step > 1e-6) {
		double delta = best * 2.0, tx, ty;
		check(x - step, y, tx, ty, delta);
		check(x + step, y, tx, ty, delta);
		check(x, y - step, tx, ty, delta);
		check(x, y + step, tx, ty, delta);
		if (delta >= best - EPS) {
			step *= 0.5;
		}
		else {
			x = tx, y = ty;
			best = delta;
		}
	}
	return point(x, y);
}

point inner(point A, point B, point C)
{
	double a = dist(B, C);
	double b = dist(A, C);
	double c = dist(A, B);
	return point((A.x * a + B.x * b + C.x * c) / (a + b + c), (A.y * a + B.y * b + C.y * c) / (a + b + c));
}

int main()
{
	ios::sync_with_stdio(false);
	int T, cas;
	cin >> T;
	while (T--) {
		cin >> cas;
		for (int i = 0; i < 3; i++) {
			cin >> deg[i] >> CL[i];
			deg[i] = 90.0 - deg[i];
			if (deg[i] < 0) deg[i] += 360.0;
			deg[i] *= PI / 180.0;
			Q[i] = point(P[i].x + cos(deg[i]) * 100.0, P[i].y + sin(deg[i]) * 100.0);
		}
		point A = intersect(P[0], Q[0], P[1], Q[1]);
		point B = intersect(P[0], Q[0], P[2], Q[2]);
		point C = intersect(P[1], Q[1], P[2], Q[2]);
		//cout << A.x << ' ' << A.y << endl;
		//cout << B.x << ' ' << B.y << endl;
		//cout << C.x << ' ' << C.y << endl;
		//point O = point((A.x + B.x + C.x) / 3.0, (A.y + B.y + C.y) / 3.0);
		point O = inner(A, B, C);
		//cout << O.x << ' ' << O.y << endl;
		point ans = gao(O);
		printf("%d %.3f %.3f\n", cas, ans.x, ans.y);
	}
	return 0;
}