nim, mike, kite = map(int, input().split())

INF = 10 ** 11 + 1
S = [-INF] + [int(input()) for _ in range(nim)] + [INF]
T = [-INF] + [int(input()) for _ in range(mike)] + [INF]
X = [int(input()) for _ in range(kite)]

def bsr(a, v):
	lo, hi = 0, len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x < a[mid]: hi = mid
		else: lo = mid + 1
	return lo

for x in X:
	sr = bsr(S, x)
	sl = sr - 1
	tr = bsr(T, x)
	tl = tr - 1
	cost = []
	for m in [S[sr], S[sl]]:
		for n in [T[tr], T[tl]]:
			cost += [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)]
	print(min(cost)) nim, mike, kite = map(int, input().split()) nim map(int, input().split()) map int input().split() ().split () input split mike kite INF = 10 ** 11 + 1 INF 10 ** 11 + 1 10 ** 11 10 11 1 int(input()) for _ in range(nim) for _ in range(nim) _ range(nim) range nim for _ in range(nim) int(input()) int input() input S = [-INF] + [int(input()) for _ in range(nim)] + [INF] S [-INF] + [int(input()) for _ in range(nim)] + [INF] [-INF] + [int(input()) for _ in range(nim)] [-INF] -INF INF [int(input()) for _ in range(nim)] [INF] INF int(input()) for _ in range(mike) for _ in range(mike) _ range(mike) range mike for _ in range(mike) int(input()) int input() input T = [-INF] + [int(input()) for _ in range(mike)] + [INF] T [-INF] + [int(input()) for _ in range(mike)] + [INF] [-INF] + [int(input()) for _ in range(mike)] [-INF] -INF INF [int(input()) for _ in range(mike)] [INF] INF int(input()) for _ in range(kite) for _ in range(kite) _ range(kite) range kite for _ in range(kite) int(input()) int input() input X = [int(input()) for _ in range(kite)] X [int(input()) for _ in range(kite)] def bsr(a, v):
	lo, hi = 0, len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x < a[mid]: hi = mid
		else: lo = mid + 1
	return lo bsr lo, hi = 0, len(a) lo 0 hi len(a) len a while lo < hi:
		mid = (lo + hi) // 2
		if x < a[mid]: hi = mid
		else: lo = mid + 1
	 lo < hi lo hi mid = (lo + hi) // 2 mid (lo + hi) // 2 lo + hi lo hi 2 if x < a[mid]: hi = mid
		else: lo = mid + 1
	 x < a[mid] x a[mid] a mid return lo lo a a v v for x in X:
	sr = bsr(S, x)
	sl = sr - 1
	tr = bsr(T, x)
	tl = tr - 1
	cost = []
	for m in [S[sr], S[sl]]:
		for n in [T[tr], T[tl]]:
			cost += [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)]
	print(min(cost)) x X sr = bsr(S, x) sr bsr(S, x) bsr S x sl = sr - 1 sl sr - 1 sr 1 tr = bsr(T, x) tr bsr(T, x) bsr T x tl = tr - 1 tl tr - 1 tr 1 cost = [] cost [] for m in [S[sr], S[sl]]:
		for n in [T[tr], T[tl]]:
			cost += [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)]
	 m [S[sr], S[sl]] S[sr] S sr S[sl] S sl for n in [T[tr], T[tl]]:
			cost += [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)]
	 n [T[tr], T[tl]] T[tr] T tr T[tl] T tl cost += [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)] cost [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)] abs(x - m) + abs(m - n) abs(x - m) abs x - m x m abs(m - n) abs m - n m n abs(x - n) + abs(m - n) abs(x - n) abs x - n x n abs(m - n) abs m - n m n print(min(cost)) print min(cost) min cost def bsr(a, v):
	lo, hi = 0, len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x < a[mid]: hi = mid
		else: lo = mid + 1
	return lo def bsr(a, v):
	lo, hi = 0, len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x < a[mid]: hi = mid
		else: lo = mid + 1
	return lo bsr tr = bsr(T, x) bsr(T, x) tr S = [-INF] + [int(input()) for _ in range(nim)] + [INF] [-INF] + [int(input()) for _ in range(nim)] + [INF] S sr = bsr(S, x) bsr(S, x) sr kite = map(int, input().split()) map(int, input().split()) kite X = [int(input()) for _ in range(kite)] [int(input()) for _ in range(kite)] X INF = 10 ** 11 + 1 10 ** 11 + 1 INF cost += [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)] [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)] cost nim, mike, kite = map(int, input().split()) map(int, input().split()) nim T = [-INF] + [int(input()) for _ in range(mike)] + [INF] [-INF] + [int(input()) for _ in range(mike)] + [INF] T cost = [] [] cost sl = sr - 1 sr - 1 sl tl = tr - 1 tr - 1 tl mike, kite = map(int, input().split()) map(int, input().split()) mike
nim, mike, kite = map(int, input().split())

INF = 10 ** 11 + 1
S = [-INF] + [int(input()) for _ in range(nim)] + [INF]
T = [-INF] + [int(input()) for _ in range(mike)] + [INF]
X = [int(input()) for _ in range(kite)]

def bsr(a, v):
	lo, hi = 0, len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x < a[mid]: hi = mid
		else: lo = mid + 1
	return lo

for x in X:
	sr = bsr(S, x)
	sl = sr - 1
	tr = bsr(T, x)
	tl = tr - 1
	cost = []
	for m in [S[sr], S[sl]]:
		for n in [T[tr], T[tl]]:
			cost += [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)]
	print(min(cost))
