/* TU Darmstadt Programming Contest 2001
 * Problem: Cramer's Rule
 * Author : Christoph Mueller <cmueller@mathematik.tu-darmstadt.de>
 * Comment:
 */                                                                                                     
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>

#define abs(x) (x >= 0 ? x : -x)
#define mat(i,j) (pos == j-1 ? b[i-1] : a[3*(i-1)+j-1])
#define quotient(a,b) (abs((a)/(float) (b)) < 0.0005 ? 0.000 : (a)/(float) (b))

/* calculate the determinant of the 3x3-matrix stored at "a", or, for 
 * pos=0,1,2, substitute the vector stored at "b" for the corresponding 
 * column of "a". This is done by using the macro "mat" for accessing 
 * matrix elements. */

int det(int *a, int *b, int pos)
{
  return mat(1,1) * (mat(2,2) * mat(3,3) - mat(2,3) * mat(3,2))
       - mat(1,2) * (mat(2,1) * mat(3,3) - mat(2,3) * mat(3,1))
       + mat(1,3) * (mat(2,1) * mat(3,2) - mat(2,2) * mat(3,1));
}

int main(void)
{
  int i;
  int scen;
  int a[9], b[3], A[4];

  /* read the number of scenarios */

  scanf("%d", &scen);

  /* for every scenario... */

  while(scen--)
  {
    /* read matrix and vector */
  
    for(i=0; i<3; i++)
      {
	scanf("%d%d%d%d", a+3*i, a+3*i+1, a+3*i+2, b+i);
	assert(-1000 <= a[3*i] && a[3*i] <= 1000);
	assert(-1000 <= a[3*i+1] && a[3*i+1] <= 1000);
	assert(-1000 <= a[3*i+2] && a[3*i+2] <= 1000);
	assert(-1000 <= b[i] && b[i] <= 1000);
      }

    /* calculate the four determinants and print results */        

    for(i=0; i<4; i++)
    {
      A[i] = det(a, b, i);
      printf("%d", A[i]);
      if(i<3) printf(" ");
    }
    printf("\n");

    /* check, if unique solution exists and print it */

    if(A[3]) 
      printf("Unique solution: %.3f %.3f %.3f\n\n", 
	     quotient(A[0],A[3]), quotient(A[1],A[3]), quotient(A[2],A[3]));
    else
      printf("No unique solution\n\n");
  }

  return 0;
}
