#include <stdio.h>
int main()
{
int t,z,x;
int a[100];
int i;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%d%d%d%d",&a[0+(i-1)*5],&a[1+(i-1)*5],&a[2+(i-1)*5],&a[3+(i-1)*5]);
}
for(i=1;i<=t;i++)
{
z=a[3+(i-1)*5]-a[2+(i-1)*5];
x=a[2+(i-1)*5]-a[1+(i-1)*5];
if(z==x)
{
a[4+(i-1)*5]=a[3+(i-1)*5]+z;
}
else
{
a[4+(i-1)*5]=a[3+(i-1)*5]*a[3+(i-1)*5]/a[2+(i-1)*5];
}
printf("%d %d %d %d %d\n",a[0+(i-1)*5],a[1+(i-1)*5],a[2+(i-1)*5],a[3+(i-1)*5],a[4+(i-1)*5]);
}
return 0;
}