#P1941F. Rudolf and Imbalance

    ID: 10356 Type: RemoteJudge 3000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 6 Uploaded By: Tags>binary searchgreedysortingstwo pointers*1800

Rudolf and Imbalance

Description

Rudolf has prepared a set of nn problems with complexities a1<a2<a3<<ana_1 < a_2 < a_3 < \dots < a_n. He is not entirely satisfied with the balance, so he wants to add at most one problem to fix it.

For this, Rudolf came up with mm models of problems and kk functions. The complexity of the ii-th model is did_i, and the complexity of the jj-th function is fjf_j. To create a problem, he selects values ii and jj (1im1 \le i \le m, 1jk1 \le j \le k) and by combining the ii-th model with the jj-th function, he obtains a new problem with complexity di+fjd_i + f_j (a new element is inserted into the array aa).

To determine the imbalance of the set, Rudolf sorts the complexities of the problems in ascending order and finds the largest value of aiai1a_i - a_{i - 1} (i>1i > 1).

What is the minimum value of imbalance that Rudolf can achieve by adding at most one problem, created according to the described rules?

The first line of the input contains a single integer tt (1t1041 \le t \le 10^4) — the number of testcases.

The first line of each test case contains three integers nn, mm, and kk (2n1052 \le n \le 10^5, 1m,k21051 \le m, k \le 2 \cdot 10^5) — the number of prepared problems, the number of models, and the number of functions, respectively.

The second line of each test case contains nn integers a1,a2,a3,ana_1, a_2, a_3, \dots a_n (1ai21091 \le a_i \le 2 \cdot 10^9, ai<ai+1a_i < a_{i+1}) — the complexities of the prepared problems.

The third line of each test case contains mm integers d1,d2,d3,dmd_1, d_2, d_3, \dots d_m (1di1091 \le d_i \le 10^9) — the complexities of the models.

The fourth line of each test case contains kk integers f1,f2,f3,fkf_1, f_2, f_3, \dots f_k (1fi1091 \le f_i \le 10^9) — the complexities of the functions.

It is guaranteed that the sum of nn over all testcases does not exceed 10510^5.

It is guaranteed that the sum of mm over all testcases does not exceed 21052 \cdot 10^5.

It is guaranteed that the sum of kk over all testcases does not exceed 21052 \cdot 10^5.

For each testcase, output a single number — the minimum imbalance that Rudolf can achieve.

Input

The first line of the input contains a single integer tt (1t1041 \le t \le 10^4) — the number of testcases.

The first line of each test case contains three integers nn, mm, and kk (2n1052 \le n \le 10^5, 1m,k21051 \le m, k \le 2 \cdot 10^5) — the number of prepared problems, the number of models, and the number of functions, respectively.

The second line of each test case contains nn integers a1,a2,a3,ana_1, a_2, a_3, \dots a_n (1ai21091 \le a_i \le 2 \cdot 10^9, ai<ai+1a_i < a_{i+1}) — the complexities of the prepared problems.

The third line of each test case contains mm integers d1,d2,d3,dmd_1, d_2, d_3, \dots d_m (1di1091 \le d_i \le 10^9) — the complexities of the models.

The fourth line of each test case contains kk integers f1,f2,f3,fkf_1, f_2, f_3, \dots f_k (1fi1091 \le f_i \le 10^9) — the complexities of the functions.

It is guaranteed that the sum of nn over all testcases does not exceed 10510^5.

It is guaranteed that the sum of mm over all testcases does not exceed 21052 \cdot 10^5.

It is guaranteed that the sum of kk over all testcases does not exceed 21052 \cdot 10^5.

Output

For each testcase, output a single number — the minimum imbalance that Rudolf can achieve.

Sample Input 1

7
5 5 5
5 10 15 20 26
11 14 16 13 8
16 4 5 3 1
7 6 5
1 4 7 10 18 21 22
2 3 5 7 4 2
6 8 9 3 2
7 6 5
1 4 7 10 18 21 22
2 3 5 7 4 2
6 8 13 3 2
5 6 3
2 10 13 20 25
11 6 10 16 14 5
6 17 15
4 2 2
11 12 14 15
19 14
10 6
8 4 2
3 10 16 18 21 22 29 30
9 13 16 15
4 2
2 4 7
4 21
4 15 14 5
20 1 15 1 12 5 11

Sample Output 1

5
4
5
8
2
7
11