import heapq
t = int(input())
for _ in range(t):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
diffs = []
for i in range(1, n):
diffs.append((a[i]-a[i-1], a[i-1], a[i]))
diffs.sort()
if len(c) < len(b):
b, c = c, b
c = sorted(c)
target = (diffs[-1][1] + diffs[-1][2]) / 2
closest = diffs[-1][1]
for x in b:
l = 0
r = len(c) - 1
while l <= r:
m = (l + r) // 2
t = x + c[m]
if abs(target - t) < abs(target - closest):
closest = t
if t < target:
l = m + 1
else:
r = m - 1
d1 = closest - diffs[-1][1]
d2 = diffs[-1][2] - closest
if len(diffs) == 1:
print(max(d1, d2))
else:
print(max(diffs[-2][0], max(d1, d2)))
3. Longest Substring Without Repeating Characters | 1312. Minimum Insertion Steps to Make a String Palindrome |
1092. Shortest Common Supersequence | 1044. Longest Duplicate Substring |
1032. Stream of Characters | 987. Vertical Order Traversal of a Binary Tree |
952. Largest Component Size by Common Factor | 212. Word Search II |
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |