package practice;
import java.util.Scanner;
public class no004 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scn = new Scanner(System.in);
int line = scn.nextInt();
int i1,i2,i3,i4;
while(0 < line && line <=20) {
i1=scn.nextInt();
i2=scn.nextInt();
i3=scn.nextInt();
i4=scn.nextInt();
int n1 = i4-i3,n2 = i3-i2;
int d1 = i4/i3,d2 = i3/i2;
if(n1==n2 ) {
for(int j = 0 ;j < 5 ;j++) {
System.out.print(i1 + (i2-i1)*j + " ");
}
System.out.println();
}else if(d1==d2) {
int r = i2/i1;
for(int j = 0 ;j < 5 ;j++) {
int n = (int) Math.pow(r,j);
System.out.print(i1*n+" ");
}
break;
}
line--;
}
}
}