t = input()
for i in range(1, int(t)+1):
list1 = [int(x) for x in input().split()]
if (list1[1]-list1[0] == list1[2]-list1[1]):
list1.append(list1[3] + (list1[1]-list1[0]))
elif (list1[1]/list1[0] == list1[2]/list1[1]):
list1.append(int(list1[3]*(list1[1]/list1[0])))
print(*list1)