row = int(input())
for i in range(row):
a = map(int,input().split())
a = [int(i) for i in a]
if(a[3]-a[2] == a[2]-a[1]):
a.append((a[3] + (a[3]-a[2])))
elif(a[3]/a[2] == a[2]/a[1]):
a.append((a[3]*(a[3]//a[2])))
print(a[0],a[1],a[2],a[3],a[4])