#include <iostream>
using namespace std;
int sum = 1 ;
int fab(int ,int);
int main(){
int num ,i = 0;
cin >> num ;
int seq[5] = {0};
bool equalratio = true ;
do
{
for(int i = 0 ; i < 4 ; i++){
cin >> seq[i];
}
for(int j = 0 ; j < 2 ; j++ ){
if(seq[j+1]/seq[j] != seq[j+2] / seq[j+1]){
equalratio = false;
}
}
if(equalratio == true){
for(int i = 0 ; i < 5 ; i++){
if( i == 0 ){
cout << seq[0];
}
else{
fab(i,seq[2] / seq[1]);
cout << seq[0] * sum << " ";
sum = 1;
}
}
}else{
for(int i = 1 ; i <= 5 ; i++){
cout << seq[0] + (i-1)*(seq[1]-seq[0]) << " ";
}
}
equalratio = true ;
i++;
}while( i < num );
}
int fab(int j , int mis){
for( int i = 0 ; i < j ; i++ )
sum *= mis;
return sum ;
}