// NY 2011
// Practice 10/20/2012

import java.util.*;

public class g {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		// Process each case.
		int n =stdin.nextInt();
		for (int loop=1; loop<=n; loop++) {

			int caseNum = stdin.nextInt();

			pt A = new pt(0,0);
			double x = stdin.nextDouble();
			pt B = new pt(x, 0);
			x = stdin.nextDouble();
			double y = stdin.nextDouble();
			pt C = new pt(x,y);
			x = stdin.nextDouble();
			y = stdin.nextDouble();
			pt D = new pt(x,y);

			solve(A, B, C, D, loop);

		}
	}

	public static void solve(pt A, pt B, pt C, pt D, int kase) {

		// Calculate all four midpoints.
		pt Dprime = new pt( (A.x+B.x)/2, (A.y+B.y)/2);
		pt Aprime = new pt( (C.x+B.x)/2, (C.y+B.y)/2);
		pt Bprime = new pt( (C.x+D.x)/2, (C.y+D.y)/2);
		pt Cprime = new pt( (A.x+D.x)/2, (A.y+D.y)/2);

		// Create each line segment.
		seg one = new seg(A, Aprime);
		seg two = new seg(B, Bprime);
		seg three = new seg(C, Cprime);
		seg four = new seg(D, Dprime);

		// Calculate appropriate intersections and triangles.
		// Here we calculate Dave's area.
		tri t1 = new tri(A, D, Dprime);
		pt q1 = one.intersect(four);
		pt q4 = three.intersect(four);
		tri botleft = new tri(A, Dprime, q1);
		tri topleft = new tri(D, Cprime, q4);
		double dave = t1.area() - botleft.area();

		// Al's Area.
		tri t2 = new tri(A, B, Aprime);
		pt q2 = one.intersect(two);
		tri botright = new tri(B, Aprime, q2);
		double al = t2.area() - botright.area();

		// Bob's area.
		tri t3 = new tri(B, C, Bprime);
		pt q3 = two.intersect(three);
		tri topright = new tri(C, Bprime, q3);
		double bob = t3.area() - topright.area();

		// Chas's area.
		tri t4 = new tri(C, D, Cprime);
		double chas = t4.area() - topleft.area();

		// Emily's requires lots of subtraction from the whole...
		tri onehalf = new tri(A, B, C);
		tri otherhalf = new tri(A, C, D);
		double emily = onehalf.area() + otherhalf.area() - t2.area() - t4.area() - (bob - botright.area()) - (dave - topleft.area());

		// The fence distance is easy enough since we had to calculate each point of intersection already...
		double fence = 16.5*(q1.dist(q2) + q2.dist(q3) + q3.dist(q4) + q4.dist(q1));
		int ans = (int)(Math.ceil(fence));

		// Output with annoying conversions...
		System.out.printf("%d %.3f %.3f %.3f %.3f %.3f %d\n", kase, al/160, bob/160, chas/160, dave/160, emily/160, ans);
	}
}

class pt {

	public double x;
	public double y;

	public pt(double myx, double myy) {
		x = myx;
		y = myy;
	}

	public double dist(pt other) {
		return Math.sqrt(Math.pow(this.x-other.x,2) + Math.pow(this.y-other.y,2));
	}

	public String toString() {
		return x+","+y;
	}
}

class tri {

	public pt[] points;

	public tri(pt A, pt B, pt C) {
		points = new pt[3];
		points[0] = A;
		points[1] = B;
		points[2] = C;
	}

	// Just calculates Hero's formula...
	public double area() {
		double p = 0;
		double[] sides = new double[3];

		for (int i=0; i<points.length; i++) {
			sides[i] = points[i].dist(points[(i+1)%points.length]);
			p += sides[i];
		}

		double s = p/2;

		double sqarea = s;
		for (int i=0; i<points.length; i++)
			sqarea = sqarea*(s - sides[i]);

		return Math.sqrt(sqarea);
	}
}

class seg {

	public pt start;
	public pt end;
	public double dx;
	public double dy;

	public seg(pt myS, pt myE) {
		start = myS;
		end = myE;
		dx = end.x - start.x;
		dy = end.y - start.y;
	}

	// Assumes intersection exists, since this problem only has intersecting segments.
	public pt intersect(seg other) {

		double c1 = other.start.x - this.start.x;
		double c2 = other.start.y - this.start.y;

		double lambda = det(c1, other.dx, c2, other.dy)/det(this.dx, other.dx, this.dy, other.dy);

		return new pt(this.start.x+lambda*this.dx, this.start.y+lambda*this.dy);
	}

	public static double det(double a, double b, double c, double d) {
		return a*d - b*c;
	}
}