SP26703 MINDIFF - All about Sorting!
Description
You will be given three sorted arrays. Let’s denote the three arrays as A, B and C.
Your task is fairly very simple. You just have to find one element from each of the three arrays so that **(|A $ _{i} $ -B $ _{j} $ | + |B $ _{j} $ -C $ _{k} $ | + |C $ _{k} $ -A $ _{i} $ |)** is the smallest. Here A $ _{i} $ is an element from array A. B $ _{j} $ is an element form array B. C $ _{k} $ is an element form array C.
Input Format
The first line of the input will be an integer T denote the number of test cases.
For each of the test cases there will three integers **Na Nb Nc** in the first line. Na will denote the size of array A, Nb will denote the size of array B, Nc will denote the size of array C.
In the second line of each test case there will be Na number of integers denoting the elements of array A.
In the third line of each test case there will be Nb number of integers denoting the elements of array B.
In the fourth line of each test case there will be Nc number of integers denoting the elements of array C.
Output Format
For each test case print the desired result.