#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
const double eps=1e-6;
const double pi=acos(-1.0);
//可以在Point里面用Vec了
class Point;
typedef Point Vec;
//三态函数比较;精度问题
int dcmp(double x){
if(fabs(x)<eps) return 0;
return x<0?-1:1;
}
struct Point{
double x,y;
Point(double _x=0,double _y=0):x(_x),y(_y){}
/*
*向量运算
*/
//向量与常数 注意常数要放在后面
Vec operator*(double p){
return Vec(x*p,y*p);
}
Vec operator/(double p){
return Vec(x/p,y/p);
}
//向量与向量
Vec operator-(Vec obj){
return Vec(x-obj.x,y-obj.y);
}
Vec operator+(Vec obj){
return Vec(x+obj.x,y+obj.y);
}
//点积
double operator*(Vec obj){
return x*obj.x+y*obj.y;
}
//叉积
double operator^(Vec obj){
return x*obj.y-y*obj.x;
}
//两个向量的夹角 A*B=|A|*|B|*cos(th)
double Angle(Vec B){
return acos((*this)*B/(*this).len()/B.len());
}
//两条向量平行四边形的面积
double Area(Vec B){
return fabs((*this)^B);//
}
//向量旋转
//旋转公式
// Nx (cos -sin) x
// =
// Ny (sin cos) y
Vec Rotate(double rad){
return Vec(x*cos(rad)-y*sin(rad),x*sin(rad)+y*cos(rad));
}
//返回向量的法向量,即旋转pi/2
Vec Normal(){
//返回单位法向量,注意L不能为0
/*
double L=obj.len();
return Vec(-y/L,x/L);
*/
//返回法向量
return Vec(-y,x);
}
/*
* 向量的性质
*/
//返回向量的长度,或者点距离原点的距离
double len(){
return hypot(x,y);
}
//返回两点之间的距离
double dis(Point obj){
//return hypot(x-obj.x,y-obj.y); //hypot 给定直角三角形的两条直角边,返回斜边边长
return sqrt((x-obj.x)*(x-obj.x)+(y-obj.y)*(y-obj.y));
}
//向量的极角 atan2(y,x)
/*
*向量的关系
*/
bool operator==(Point obj){
return dcmp(x-obj.x)==0&&dcmp(y-obj.y)==0;
}
bool operator<(Point obj){
return x<obj.x||(x==obj.x&&y<obj.y);
}
};
Point p[10];
Point GetD(Point P,Vec v,Point Q,Vec w){
Vec u=P-Q;
double t=(w^u)/(v^w);
return P+v*t;
}
/*
2
1 1 2 2 1 2
0 0 100 0 50 50
*/
int main(){
int T;
scanf("%d",&T);
while(T--){
rep(i,0,3){
double x,y;
scanf("%lf %lf",&x,&y);
p[i]=Point(x,y);
}
// printf("1/12:%.2f %.2f 1/6:%.2f %.2f\n",1.0/12*pi,2*pi-1.0/12*pi,1.0/6*pi,2*pi-1.0/6*pi);
for(int i=0;i<3;i++){
Point A=p[i],B=p[(i+1)%3],C=p[(i+2)%3];
double th1=acos((A-B)*(C-B)/(A-B).len()/(C-B).len());
th1/=3.0;
Vec bd=(C-B).Rotate(th1);
double th2=acos((A-C)*(B-C)/(A-C).len()/(B-C).len());
th2/=3.0; th2=2.0*pi-th2;
Vec cd=(B-C).Rotate(th2);
p[i+3]=GetD(B,bd,C,cd);
// printf("bd(%.2f,%.2f) cd(%.2f,%.2f)\n",bd.x,bd.y,cd.x,cd.y);
// printf("th1:%.2f th2:%.2f (%.2f,%.2f)\n\n",th1,th2,p[i+3].x,p[i+3].y);
}
rep(i,3,6) printf("%.6f %.6f%c",p[i].x,p[i].y,i==5?'\n':' ');
}
return 0;
}