#include <stdio.h>
#include <stdlib.h>
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
int a,b,c,d;
scanf("%d %d %d %d",&a,&b,&c,&d);
if(d-c==c-b)
printf("%d %d %d %d %d\n",a,b,c,d,d+(d-c));
else if(d/c==c/b)
printf("%d %d %d %d %d\n",a,b,c,d,d*(d/c));
}
}