Scientists from the planet Krypton have figured out a way to grow artificial sugar in space. They have constructed a huge 3-dimensional steel grid upon which they will produce artificial sugar. Each sugar stock will be attached to a point on the grid. A cosmic ant wants to crawl from stock X to stock Y along the grid line.

The cosmic ant always chooses the shortest possible path along the grid lines while going from stock X to stock Y. The ant has an Energy capacity, and he loses 1 unit energy in walking 1 unit of distance. He can not walk further with 0 energy. Now, the scientists want to perform a test run on the grid. For that, they have to perform N operations. In each operation, they will produce a new sugar stock on the grid. Then they will ask you to find out the minimum required energy capacity for the ant such that tthe ant can visit any sugar stock from any other sugar stock.

Input

The first line of input gives the number of cases, T (1 ≤ T ≤ 5 ). T test cases follow. Each one starts with a line containing the number of operations N (1 ≤ N ≤ 5×104). The next N lines will each give the 3-dimensional coordinates of a sugar stock (integers in the range [−108, 108]).

Output

For each test case, output test case number and N lines containing the answer for each query.