Have you ever ridden a cable car? It is a lot of fun. Our company is building a new cable car line between two high mountains, and you get a free ride if you help design it.
The company wants one platform on each mountain, and the cable runs between those two platforms. The spots suitable for a platform have already been surveyed on both mountains, and the altitude of every spot is recorded.
One engineer pointed out that the line saves a lot of energy when the two platforms sit at the same altitude, or as close to each other as possible. Pick one surveyed spot on each mountain so that the altitude difference between them is as small as possible.
The first line contains the number of test cases T (1≤T≤100). Then 2T lines follow, two lines per test case.
The two lines of a test case each describe the altitudes of the suitable platform spots on one mountain. Each line starts with the number of recorded altitudes N (1≤N≤1000), followed by the N altitudes recorded on that mountain. Every altitude is an integer between 1 and 1000000, inclusive.
For each test case, print on a single line the smallest altitude difference you can reach by picking one spot on each mountain.