Command and Conquer: Red Alert 2

아직 제출이 없습니다시간 제한10초메모리 제한512 MB

문제

Being a nostalgic boy, Nocriz loves watching HBK08 and Lantian28 playing the game Command and Conquer: Red Alert 2. However, he doesn't know how to play the game himself.

In the game, you own a sniper initially located at (10100,10100,10100)(-10^{100}, -10^{100}, -10^{100}) in a 3D world. There are nn enemy soldiers, where the ii-th soldier is located at (x_i,y_i,z_i)(x\_i, y\_i, z\_i). We say the range of the sniper to be kk if the sniper can kill all enemies such that max(x_sx_e,y_sy_e,z_sz_e)k\max(|x\_s - x\_e|, |y\_s - y\_e|, |z\_s - z\_e|) \le k, where (x_s,y_s,z_s)(x\_s, y\_s, z\_s) is the location of the sniper and (x_e,y_e,z_e)(x\_e, y\_e, z\_e) is the location of the enemy.

In one step, the sniper can move from (x,y,z)(x, y, z) to (x+1,y,z)(x + 1, y, z), (x,y+1,z)(x, y + 1, z), or (x,y,z+1)(x, y, z + 1). The enemies don't move. The sniper is allowed to make an unlimited number of steps, and is allowed to kill all enemies in range whenever all his coordinates are integers. What is the minimum range kk such that the sniper can eventually kill all enemies?

입력

The first line contains an integer TT (1T51041 \le T \le 5 \cdot 10^4), the number of test cases. Then TT test cases follow.

The first line of each test case contains a single integer nn (1n51051 \le n \le 5 \cdot 10^5), the number of enemies.

Then nn lines follow, each contains three integers x_ix\_i, y_iy\_i, z_iz\_i (109x_i,y_i,z_i109-10^9 \le x\_i, y\_i, z\_i \le 10^9) denoting the location of the ii-th enemy.

It is guaranteed that n2106\sum n \le 2 \cdot 10^6.

출력

For each test case, output a line with a single integer representing the answer.