A, B, Q = map(int, input().split())

Jinja = []
Tera = []
Ichi = []
for i in range (0, A):
	Jinja.append(int(input()))
for i in range (0, B):
	Tera.append(int(input()))
for i in range (0, Q):
	Ichi.append(int(input()))

import math
import bisect as bi

for i in range (0, Q):
	temp = Ichi[i]
	J = math.inf
	T = math.inf
	JL = bi.bisect_left(Jinja, temp)
	JR = bi.bisect_right(Jinja, temp)
	TL = bi.bisect_left(Tera, temp)
	TR = bi.bisect_right(Tera, temp)
	if JL != JR:
		J = 0
	if TL != TR:
		T = 0
	if JR == 0:
		JW = math.inf
		JE = abs(temp-Jinja[0])
	elif JL == A:
		JW = abs(temp-Jinja[A-1])
		JE = math.inf
	else:
		JW = abs(temp-Jinja[JL-1])
		JE = abs(temp-Jinja[JL])
	if TR == 0:
		TW = math.inf
		TE = abs(temp-Tera[0])	
	elif TL == B:
		TW = abs(temp-Tera[B-1])
		TE = math.inf	
	else:
		TW = abs(temp-Tera[TL-1])
		TE = abs(temp-Tera[TL])
	print(min(J+T, J+TW, J+TE, T+JW, T+JE, max(JW, TW), max(JE, TE), 2*JW+TE, 2*TE+JW, 2*JE+TW, 2*TW+JE)) A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q Jinja = [] Jinja [] Tera = [] Tera [] Ichi = [] Ichi [] for i in range (0, A):
	Jinja.append(int(input())) i range (0, A) range 0 A Jinja.append(int(input())) Jinja.append Jinja append int(input()) int input() input for i in range (0, B):
	Tera.append(int(input())) i range (0, B) range 0 B Tera.append(int(input())) Tera.append Tera append int(input()) int input() input for i in range (0, Q):
	Ichi.append(int(input())) i range (0, Q) range 0 Q Ichi.append(int(input())) Ichi.append Ichi append int(input()) int input() input import math math import bisect as bi bisect for i in range (0, Q):
	temp = Ichi[i]
	J = math.inf
	T = math.inf
	JL = bi.bisect_left(Jinja, temp)
	JR = bi.bisect_right(Jinja, temp)
	TL = bi.bisect_left(Tera, temp)
	TR = bi.bisect_right(Tera, temp)
	if JL != JR:
		J = 0
	if TL != TR:
		T = 0
	if JR == 0:
		JW = math.inf
		JE = abs(temp-Jinja[0])
	elif JL == A:
		JW = abs(temp-Jinja[A-1])
		JE = math.inf
	else:
		JW = abs(temp-Jinja[JL-1])
		JE = abs(temp-Jinja[JL])
	if TR == 0:
		TW = math.inf
		TE = abs(temp-Tera[0])	
	elif TL == B:
		TW = abs(temp-Tera[B-1])
		TE = math.inf	
	else:
		TW = abs(temp-Tera[TL-1])
		TE = abs(temp-Tera[TL])
	print(min(J+T, J+TW, J+TE, T+JW, T+JE, max(JW, TW), max(JE, TE), 2*JW+TE, 2*TE+JW, 2*JE+TW, 2*TW+JE)) i range (0, Q) range 0 Q temp = Ichi[i] temp Ichi[i] Ichi i J = math.inf J math.inf math inf T = math.inf T math.inf math inf JL = bi.bisect_left(Jinja, temp) JL bi.bisect_left(Jinja, temp) bi.bisect_left bi bisect_left Jinja temp JR = bi.bisect_right(Jinja, temp) JR bi.bisect_right(Jinja, temp) bi.bisect_right bi bisect_right Jinja temp TL = bi.bisect_left(Tera, temp) TL bi.bisect_left(Tera, temp) bi.bisect_left bi bisect_left Tera temp TR = bi.bisect_right(Tera, temp) TR bi.bisect_right(Tera, temp) bi.bisect_right bi bisect_right Tera temp if JL != JR:
		J = 0
	 JL != JR JL JR J = 0 J 0 if TL != TR:
		T = 0
	 TL != TR TL TR T = 0 T 0 if JR == 0:
		JW = math.inf
		JE = abs(temp-Jinja[0])
	elif JL == A:
		JW = abs(temp-Jinja[A-1])
		JE = math.inf
	else:
		JW = abs(temp-Jinja[JL-1])
		JE = abs(temp-Jinja[JL])
	 JR == 0 JR 0 JW = math.inf JW math.inf math inf JE = abs(temp-Jinja[0]) JE abs(temp-Jinja[0]) abs temp-Jinja[0] temp Jinja[0] Jinja 0 elif JL == A:
		JW = abs(temp-Jinja[A-1])
		JE = math.inf
	 JL == A JL A JW = abs(temp-Jinja[A-1]) JW abs(temp-Jinja[A-1]) abs temp-Jinja[A-1] temp Jinja[A-1] Jinja A-1 A 1 JE = math.inf JE math.inf math inf JW = abs(temp-Jinja[JL-1]) JW abs(temp-Jinja[JL-1]) abs temp-Jinja[JL-1] temp Jinja[JL-1] Jinja JL-1 JL 1 JE = abs(temp-Jinja[JL]) JE abs(temp-Jinja[JL]) abs temp-Jinja[JL] temp Jinja[JL] Jinja JL if TR == 0:
		TW = math.inf
		TE = abs(temp-Tera[0])	
	elif TL == B:
		TW = abs(temp-Tera[B-1])
		TE = math.inf	
	else:
		TW = abs(temp-Tera[TL-1])
		TE = abs(temp-Tera[TL])
	 TR == 0 TR 0 TW = math.inf TW math.inf math inf TE = abs(temp-Tera[0]) TE abs(temp-Tera[0]) abs temp-Tera[0] temp Tera[0] Tera 0 elif TL == B:
		TW = abs(temp-Tera[B-1])
		TE = math.inf	
	 TL == B TL B TW = abs(temp-Tera[B-1]) TW abs(temp-Tera[B-1]) abs temp-Tera[B-1] temp Tera[B-1] Tera B-1 B 1 TE = math.inf TE math.inf math inf TW = abs(temp-Tera[TL-1]) TW abs(temp-Tera[TL-1]) abs temp-Tera[TL-1] temp Tera[TL-1] Tera TL-1 TL 1 TE = abs(temp-Tera[TL]) TE abs(temp-Tera[TL]) abs temp-Tera[TL] temp Tera[TL] Tera TL print(min(J+T, J+TW, J+TE, T+JW, T+JE, max(JW, TW), max(JE, TE), 2*JW+TE, 2*TE+JW, 2*JE+TW, 2*TW+JE)) print min(J+T, J+TW, J+TE, T+JW, T+JE, max(JW, TW), max(JE, TE), 2*JW+TE, 2*TE+JW, 2*JE+TW, 2*TW+JE) min J+T J T J+TW J TW J+TE J TE T+JW T JW T+JE T JE max(JW, TW) max JW TW max(JE, TE) max JE TE 2*JW+TE 2*JW 2 JW TE 2*TE+JW 2*TE 2 TE JW 2*JE+TW 2*JE 2 JE TW 2*TW+JE 2*TW 2 TW JE TE = abs(temp-Tera[0]) abs(temp-Tera[0]) TE TW = abs(temp-Tera[B-1]) abs(temp-Tera[B-1]) TW temp = Ichi[i] Ichi[i] temp TW = math.inf math.inf TW Tera = [] [] Tera T = math.inf math.inf T JE = abs(temp-Jinja[0]) abs(temp-Jinja[0]) JE Ichi = [] [] Ichi A, B, Q = map(int, input().split()) map(int, input().split()) A T = 0 0 T TE = math.inf math.inf TE JE = abs(temp-Jinja[JL]) abs(temp-Jinja[JL]) JE TW = abs(temp-Tera[TL-1]) abs(temp-Tera[TL-1]) TW J = 0 0 J JW = abs(temp-Jinja[JL-1]) abs(temp-Jinja[JL-1]) JW JW = math.inf math.inf JW Jinja = [] [] Jinja TR = bi.bisect_right(Tera, temp) bi.bisect_right(Tera, temp) TR Q = map(int, input().split()) map(int, input().split()) Q TE = abs(temp-Tera[TL]) abs(temp-Tera[TL]) TE JL = bi.bisect_left(Jinja, temp) bi.bisect_left(Jinja, temp) JL JW = abs(temp-Jinja[A-1]) abs(temp-Jinja[A-1]) JW TL = bi.bisect_left(Tera, temp) bi.bisect_left(Tera, temp) TL JR = bi.bisect_right(Jinja, temp) bi.bisect_right(Jinja, temp) JR JE = math.inf math.inf JE B, Q = map(int, input().split()) map(int, input().split()) B J = math.inf math.inf J
A, B, Q = map(int, input().split())

Jinja = []
Tera = []
Ichi = []
for i in range (0, A):
	Jinja.append(int(input()))
for i in range (0, B):
	Tera.append(int(input()))
for i in range (0, Q):
	Ichi.append(int(input()))

import math
import bisect as bi

for i in range (0, Q):
	temp = Ichi[i]
	J = math.inf
	T = math.inf
	JL = bi.bisect_left(Jinja, temp)
	JR = bi.bisect_right(Jinja, temp)
	TL = bi.bisect_left(Tera, temp)
	TR = bi.bisect_right(Tera, temp)
	if JL != JR:
		J = 0
	if TL != TR:
		T = 0
	if JR == 0:
		JW = math.inf
		JE = abs(temp-Jinja[0])
	elif JL == A:
		JW = abs(temp-Jinja[A-1])
		JE = math.inf
	else:
		JW = abs(temp-Jinja[JL-1])
		JE = abs(temp-Jinja[JL])
	if TR == 0:
		TW = math.inf
		TE = abs(temp-Tera[0])	
	elif TL == B:
		TW = abs(temp-Tera[B-1])
		TE = math.inf	
	else:
		TW = abs(temp-Tera[TL-1])
		TE = abs(temp-Tera[TL])
	print(min(J+T, J+TW, J+TE, T+JW, T+JE, max(JW, TW), max(JE, TE), 2*JW+TE, 2*TE+JW, 2*JE+TW, 2*TW+JE))