#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
int i;
for(i=0;i<=t;i++)
{
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
if((d-c)==(b-a))
{
e=d+(b-a);
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<"\n";}
else if((d/c)==(b/a))
{
e=d*(b/a);
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<"\n";}
return 0;
}
}