for i in range(n):
i=str(input())
m=i.split(' ')
if int(m[1])/int(m[0])==int(m[2])/int(m[1])==int(m[3])/int(m[2]):
print(f'{m[0]} {m[1]} {m[2]} {m[3]} { int( int(m[3]) * (int(m[2])/int(m[1])) )}')
else:
print(f'{m[0]} {m[1]} {m[2]} {m[3]} { int( int(m[3]) + (int(m[2])-int(m[1])) )}')