import java.util.Scanner;
public class hiii {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
int a,b,c,d=0,e=0;
int t = scanner.nextInt(); //決定行數列
int[][] ary = new int[t][5];
for(int i=0;i<t;i++){
for(int j=0;j<4;j++){
ary[i][j]=scanner.nextInt();
if(j==3){
a=ary[i][1]-ary[i][0];
b=ary[i][2]-ary[i][1];
c=ary[i][3]-ary[i][2];
if(a==b && b==c){
ary[i][4]=ary[i][3]+c;
}else{
a=ary[i][1]/ary[i][0];
b=ary[i][2]/ary[i][1];
c=ary[i][3]/ary[i][2];
ary[i][4]=ary[i][3]*c;
}
}
}
}
for(int i=0;i<t;i++){
for(int j=0;j<5;j++){
System.out.print(j==0?ary[i][0]:" " + ary[i][j]);
}
System.out.println();
}
}
}