p=input()
for i in range(20):
instring=input().split()
if len(instring)!=4:
print()
else:
string=[]
for i in range(4):
string.append(int(instring[i]))
string.sort()
if string[1]%string[0]==0:
if string[1]//string[0]==string[2]//string[1]:
m=string[0]*((string[1]//string[0])**4)
string.append(m)
for i in range(5):
print('%d'%string[i],end=' ')
else:
m=string[0]+((string[1]-string[0])*4)
string.append(m)
for i in range(5):
print('%d'%string[i],end=' ')
else:
m=string[0]+((string[1]-string[0])*4)
string.append(m)
for i in range(5):
print('%d'%string[i],end=' ')
print()