#P181. 【例30.2】回家作业

【例30.2】回家作业

Description

There are many sequence completion exercises in the homework.
The requirement for the completion exercise is: given the first four terms of a sequence, fill in the fifth term. Since it is known that these sequences can only be arithmetic or geometric sequences, she decides to write a program to complete these exercises.

Input Format

The first line contains the number of sequences t (0≤t≤20).
Each of the following lines contains four integers, representing the first four terms of a sequence.
It is agreed that the first five terms of each sequence are natural numbers not exceeding 10⁵, and the common ratio of geometric sequences is also a natural number.

Output Format

For each input sequence, output its first five terms.

Sample

2
1 2 3 4
1 2 4 8
1 2 3 4 5
1 2 4 8 16