import sys
import math
from collections import deque
import bisect

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
	A, B, Q = NMI()
	S = [-float("inf")] + [NI() for _ in range(A)] + [float("inf")]
	T = [-float("inf")] + [NI() for _ in range(B)] + [float("inf")]
	Q = [NI() for _ in range(Q)]

	for q in Q:
		s_idx = bisect.bisect_left(S, q)
		t_idx = bisect.bisect_left(T, q)
		sl, sr, tl, tr = S[s_idx-1], S[s_idx], T[t_idx-1], T[t_idx]
		LL = max(abs(q - sl), abs(q - tl))
		RR = max(abs(q - sr), abs(q - tr))
		LR = abs(q - sl) * 2 + abs(q - tr)
		RL = abs(q - sr) * 2 + abs(q - tl)
		LR2 = abs(q - tl) * 2 + abs(q - sr)
		RL2 = abs(q - tr) * 2 + abs(q - sl)
		res = min(LL, RR, LR, LR2, RL, RL2)
		print(res)


if __name__ == "__main__":
	main() import sys sys import math math from collections import deque import bisect bisect sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 input = lambda: sys.stdin.readline().strip() input lambda: sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip NI = lambda: int(input()) NI lambda: int(input()) int(input()) int input() input NMI = lambda: map(int, input().split()) NMI lambda: map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split NLI = lambda: list(NMI()) NLI lambda: list(NMI()) list(NMI()) list NMI() NMI SI = lambda: input() SI lambda: input() input() input [int(num)] * w for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) [int(num)] * w [int(num)] int(num) int num w def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)] make_grid h h w w num num def main():
	A, B, Q = NMI()
	S = [-float("inf")] + [NI() for _ in range(A)] + [float("inf")]
	T = [-float("inf")] + [NI() for _ in range(B)] + [float("inf")]
	Q = [NI() for _ in range(Q)]

	for q in Q:
		s_idx = bisect.bisect_left(S, q)
		t_idx = bisect.bisect_left(T, q)
		sl, sr, tl, tr = S[s_idx-1], S[s_idx], T[t_idx-1], T[t_idx]
		LL = max(abs(q - sl), abs(q - tl))
		RR = max(abs(q - sr), abs(q - tr))
		LR = abs(q - sl) * 2 + abs(q - tr)
		RL = abs(q - sr) * 2 + abs(q - tl)
		LR2 = abs(q - tl) * 2 + abs(q - sr)
		RL2 = abs(q - tr) * 2 + abs(q - sl)
		res = min(LL, RR, LR, LR2, RL, RL2)
		print(res) main A, B, Q = NMI() A NMI() NMI B Q NI() for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) NI() NI S = [-float("inf")] + [NI() for _ in range(A)] + [float("inf")] S [-float("inf")] + [NI() for _ in range(A)] + [float("inf")] [-float("inf")] + [NI() for _ in range(A)] [-float("inf")] -float("inf") float("inf") float "inf" [NI() for _ in range(A)] [float("inf")] float("inf") float "inf" NI() for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) NI() NI T = [-float("inf")] + [NI() for _ in range(B)] + [float("inf")] T [-float("inf")] + [NI() for _ in range(B)] + [float("inf")] [-float("inf")] + [NI() for _ in range(B)] [-float("inf")] -float("inf") float("inf") float "inf" [NI() for _ in range(B)] [float("inf")] float("inf") float "inf" NI() for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) NI() NI Q = [NI() for _ in range(Q)] Q [NI() for _ in range(Q)] for q in Q:
		s_idx = bisect.bisect_left(S, q)
		t_idx = bisect.bisect_left(T, q)
		sl, sr, tl, tr = S[s_idx-1], S[s_idx], T[t_idx-1], T[t_idx]
		LL = max(abs(q - sl), abs(q - tl))
		RR = max(abs(q - sr), abs(q - tr))
		LR = abs(q - sl) * 2 + abs(q - tr)
		RL = abs(q - sr) * 2 + abs(q - tl)
		LR2 = abs(q - tl) * 2 + abs(q - sr)
		RL2 = abs(q - tr) * 2 + abs(q - sl)
		res = min(LL, RR, LR, LR2, RL, RL2)
		print(res) q Q s_idx = bisect.bisect_left(S, q) s_idx bisect.bisect_left(S, q) bisect.bisect_left bisect bisect_left S q t_idx = bisect.bisect_left(T, q) t_idx bisect.bisect_left(T, q) bisect.bisect_left bisect bisect_left T q sl, sr, tl, tr = S[s_idx-1], S[s_idx], T[t_idx-1], T[t_idx] sl S[s_idx-1] S s_idx-1 s_idx 1 sr S[s_idx] S s_idx tl T[t_idx-1] T t_idx-1 t_idx 1 tr T[t_idx] T t_idx LL = max(abs(q - sl), abs(q - tl)) LL max(abs(q - sl), abs(q - tl)) max abs(q - sl) abs q - sl q sl abs(q - tl) abs q - tl q tl RR = max(abs(q - sr), abs(q - tr)) RR max(abs(q - sr), abs(q - tr)) max abs(q - sr) abs q - sr q sr abs(q - tr) abs q - tr q tr LR = abs(q - sl) * 2 + abs(q - tr) LR abs(q - sl) * 2 + abs(q - tr) abs(q - sl) * 2 abs(q - sl) abs q - sl q sl 2 abs(q - tr) abs q - tr q tr RL = abs(q - sr) * 2 + abs(q - tl) RL abs(q - sr) * 2 + abs(q - tl) abs(q - sr) * 2 abs(q - sr) abs q - sr q sr 2 abs(q - tl) abs q - tl q tl LR2 = abs(q - tl) * 2 + abs(q - sr) LR2 abs(q - tl) * 2 + abs(q - sr) abs(q - tl) * 2 abs(q - tl) abs q - tl q tl 2 abs(q - sr) abs q - sr q sr RL2 = abs(q - tr) * 2 + abs(q - sl) RL2 abs(q - tr) * 2 + abs(q - sl) abs(q - tr) * 2 abs(q - tr) abs q - tr q tr 2 abs(q - sl) abs q - sl q sl res = min(LL, RR, LR, LR2, RL, RL2) res min(LL, RR, LR, LR2, RL, RL2) min LL RR LR LR2 RL RL2 print(res) print res if __name__ == "__main__":
	main() __name__ == "__main__" __name__ "__main__" main() main MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD input = lambda: sys.stdin.readline().strip() lambda: sys.stdin.readline().strip() input def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)] def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)] make_grid SI = lambda: input() lambda: input() SI NMI = lambda: map(int, input().split()) lambda: map(int, input().split()) NMI def main():
	A, B, Q = NMI()
	S = [-float("inf")] + [NI() for _ in range(A)] + [float("inf")]
	T = [-float("inf")] + [NI() for _ in range(B)] + [float("inf")]
	Q = [NI() for _ in range(Q)]

	for q in Q:
		s_idx = bisect.bisect_left(S, q)
		t_idx = bisect.bisect_left(T, q)
		sl, sr, tl, tr = S[s_idx-1], S[s_idx], T[t_idx-1], T[t_idx]
		LL = max(abs(q - sl), abs(q - tl))
		RR = max(abs(q - sr), abs(q - tr))
		LR = abs(q - sl) * 2 + abs(q - tr)
		RL = abs(q - sr) * 2 + abs(q - tl)
		LR2 = abs(q - tl) * 2 + abs(q - sr)
		RL2 = abs(q - tr) * 2 + abs(q - sl)
		res = min(LL, RR, LR, LR2, RL, RL2)
		print(res) def main():
	A, B, Q = NMI()
	S = [-float("inf")] + [NI() for _ in range(A)] + [float("inf")]
	T = [-float("inf")] + [NI() for _ in range(B)] + [float("inf")]
	Q = [NI() for _ in range(Q)]

	for q in Q:
		s_idx = bisect.bisect_left(S, q)
		t_idx = bisect.bisect_left(T, q)
		sl, sr, tl, tr = S[s_idx-1], S[s_idx], T[t_idx-1], T[t_idx]
		LL = max(abs(q - sl), abs(q - tl))
		RR = max(abs(q - sr), abs(q - tr))
		LR = abs(q - sl) * 2 + abs(q - tr)
		RL = abs(q - sr) * 2 + abs(q - tl)
		LR2 = abs(q - tl) * 2 + abs(q - sr)
		RL2 = abs(q - tr) * 2 + abs(q - sl)
		res = min(LL, RR, LR, LR2, RL, RL2)
		print(res) main NI = lambda: int(input()) lambda: int(input()) NI NLI = lambda: list(NMI()) lambda: list(NMI()) NLI
import sys
import math
from collections import deque
import bisect

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
	A, B, Q = NMI()
	S = [-float("inf")] + [NI() for _ in range(A)] + [float("inf")]
	T = [-float("inf")] + [NI() for _ in range(B)] + [float("inf")]
	Q = [NI() for _ in range(Q)]

	for q in Q:
		s_idx = bisect.bisect_left(S, q)
		t_idx = bisect.bisect_left(T, q)
		sl, sr, tl, tr = S[s_idx-1], S[s_idx], T[t_idx-1], T[t_idx]
		LL = max(abs(q - sl), abs(q - tl))
		RR = max(abs(q - sr), abs(q - tr))
		LR = abs(q - sl) * 2 + abs(q - tr)
		RL = abs(q - sr) * 2 + abs(q - tl)
		LR2 = abs(q - tl) * 2 + abs(q - sr)
		RL2 = abs(q - tr) * 2 + abs(q - sl)
		res = min(LL, RR, LR, LR2, RL, RL2)
		print(res)


if __name__ == "__main__":
	main()