/* TU Darmstadt Programming Contest 2001
 * Problem: Cramer's rule
 * Author : Stefan Maier
 * Comment:
 */
import java.io.*;
import java.util.*;

public class cramer {

    protected static BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );

    public static void main( String args[ ] ) {
	
	    //String s;
	    int maxcount=0;
	    int a[][] = new int[3][3];
	    int A[] = new int[4];
	    int b[] = new int[3];
		
	    try { 
		maxcount=Integer.parseInt(in.readLine());

		for(int count=0;count<maxcount;count++){
		    //read input lines
		    for(int i=0;i<3;i++){
			StringTokenizer st = new StringTokenizer(in.readLine()," ",false);
			for(int j=0;j<3;j++){
			    a[i][j]=Integer.parseInt(st.nextToken());
			}
			b[i]=Integer.parseInt(st.nextToken());
		    }
		    
		    A[0]=det(a,b,0);
		    A[1]=det(a,b,1);
		    A[2]=det(a,b,2);
		    A[3]=det(a,b,3);
		    System.out.println(A[0]+" "+A[1]+" "+A[2]+" "+A[3]);
		    
		    if(A[3]==0)
			System.out.println("No unique solution");
		    else {
			System.out.print("Unique solution: ");
                        for(int i=0;i<3;i++){
			    float f=(float)A[i]/(float)A[3];
 				if((-0.0005<f)&&(f<0.0005))
					System.out.print("0.000");
				else {
					f=Math.round(f*1000.0)/(float)1000.0; 
					String s=String.valueOf(f)+"00"; 
					System.out.print(s.substring(0,s.indexOf(".")+4)); 
				}
                            
                            if(i<2)
                                System.out.print(" ");
			}
			System.out.println();
		    }
		    System.out.println();  
		}
		      
	    } catch ( IOException e ) {
		e.printStackTrace( );
		System.exit( 1 );
	    }
    } 
    
    public static int det(int[][] ma, int[] vb, int pos){
       return elem(ma,vb,0,0,pos)*(elem(ma,vb,1,1,pos)*elem(ma,vb,2,2,pos) - elem(ma,vb,1,2,pos)*elem(ma,vb,2,1,pos))
	    - elem(ma,vb,0,1,pos)*(elem(ma,vb,1,0,pos)*elem(ma,vb,2,2,pos) - elem(ma,vb,1,2,pos)*elem(ma,vb,2,0,pos))
	    + elem(ma,vb,0,2,pos)*(elem(ma,vb,1,0,pos)*elem(ma,vb,2,1,pos) - elem(ma,vb,1,1,pos)*elem(ma,vb,2,0,pos));
    }

    public static int elem(int[][] ma, int[] vb, int z, int s, int pos){
	if(pos==s) return vb[z];
	else return ma[z][s];
    }
}
