#include<stdio.h>
int main(void){
   int n;
   double x[10], y[10], p, q, 
   p1, p2, p3, p4, p5, p6, p7, p8, q1, q2, q3, q4, q5, q6, q7;
   scanf("%d", &n);
   while ( n ) {
       scanf("%lf %lf %lf %lf %lf %lf", &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]);
       p1 = x[2] * x[2] + y[2] * y[2] - x[3] * x[3] - y[3] * y[3];
       p2 = 2 * y[2] - 2 * y[3];
       p3 = y[1] * y[1] + x[1] * x[1] - x[2] * x[2] - y[2] * y[2];
       p4 = 2 * y[1] - 2 * y[2];
       p5 = -2 * x[1] + 2 * x[2];
       p6 = 2 * y[1] - 2 * y[2];
       p7 = -2 * x[2] + 2 * x[3];
       p8 = 2 * y[2] - 2 * y[3];
       p = ( p1 / p2 - p3 / p4 ) / ( p5 / p6 - p7 / p8 );
       printf("%lf %lf %lf %lf %lf %lf %lf %lf\n", p1, p2, p3, p4, p5, p6, p7, p8);
   }
   return 0;
}