#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	while( n-- > 0 ){
		double x[3], y[3];		// three points
		for( int i = 0; i < 3; i++ ){
			cin >> x[i] >> y[i];
		}
		double a[2];		// the slope of a line
		double b[2];		// the intersept of a line
		double ax, ay;
		int s = 0;
		for( int i = 0; i < 2; i++ ){
			if( y[i] == y[i+1] ){
				s = i+1;
			}else{
				a[i] = -(x[i] - x[i+1]) / (y[i] - y[i+1]);
				b[i] = (y[i] + y[i+1]) / 2.0 - a[i] * (x[i] + x[i+1]) / 2.0;
			}
		}
		if( a[0] == 0 ){
			ay = b[0];
			ax = ( ay - b[1] ) / a[1];
			if( s == 2){
				ax = ( x[1] + x[2] ) / 2;
				ay = a[0] * ax + b[0];
			}else if( s == 1 ){
				ax = ( x[0] + x[1] ) / 2;
				ay = a[1] * ax + b[1];
			}else{
				ax = ( b[1] - b[0] ) / ( a[0] - a[1] );
				ay = a[0] * ax + b[0];
			}
		}else if( a[1] == 0 ){
			ay = b[1];
			ax = ( ay - b[0] ) / a[0];
			if( s == 2){
				ax = ( x[1] + x[2] ) / 2;
				ay = a[0] * ax + b[0];
			}else if( s == 1 ){
				ax = ( x[0] + x[1] ) / 2;
				ay = a[1] * ax + b[1];
			}else{
				ax = ( b[1] - b[0] ) / ( a[0] - a[1] );
				ay = a[0] * ax + b[0];
			}
		}else{
			if( s == 2){
				ax = ( x[1] + x[2] ) / 2;
				ay = a[0] * ax + b[0];
			}else if( s == 1 ){
				ax = ( x[0] + x[1] ) / 2;
				ay = a[1] * ax + b[1];
			}else{
				ax = ( b[1] - b[0] ) / ( a[0] - a[1] );
				ay = a[0] * ax + b[0];
			}
		}
		double r = sqrt( pow( x[0] - ax, 2 ) + pow( y[0] - ay, 2 ) );
		printf("%.3f %.3f %.3f\n", ax, ay, r );
	}
}