# Original solution
import bisect

A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
#print("S:", S)
#print("T:", T)

for i in range(Q):
  
  x = X[i]
  answer = 10 ** 12
  
  i1 = bisect.bisect_right(S, x) - 1
  i2 = (i1 + 1) % A
  S1 = S[i1]
  S2 = S[i2]  
  dist1 = abs(x - S1)
  dist2 = abs(x - S2)
  #print("dist1, dist2:", dist1, dist2)
  
  i11 = bisect.bisect_right(T, S1) - 1
  i12 = (i11 + 1) % B
  T11 = T[i11]
  T12 = T[i12]
  dist11 = abs(S1 - T11)
  dist12 = abs(S1 - T12)
  #print("dist11, dist12:", dist11, dist12)
    
  i21 = bisect.bisect_right(T, S2) - 1
  i22 = (i21 + 1) % B
  T21 = T[i21]
  T22 = T[i22]
  dist21 = abs(S2 - T21)
  dist22 = abs(S2 - T22)
  #print("dist21, dist22:", dist21, dist22)
  
  dist = min(dist1 + min(dist11, dist12), dist2 + min(dist21, dist22))
  answer = min(answer, dist)
  
  S, T = T, S
  A, B = B, A

  i1 = bisect.bisect_right(S, x) - 1
  i2 = (i1 + 1) % A
  S1 = S[i1]
  S2 = S[i2]  
  dist1 = abs(x - S1)
  dist2 = abs(x - S2)
  #print("dist1, dist2:", dist1, dist2)
  
  i11 = bisect.bisect_right(T, S1) - 1
  i12 = (i11 + 1) % B
  T11 = T[i11]
  T12 = T[i12]
  dist11 = abs(S1 - T11)
  dist12 = abs(S1 - T12)
  #print("dist11, dist12:", dist11, dist12)
    
  i21 = bisect.bisect_right(T, S2) - 1
  i22 = (i21 + 1) % B
  T21 = T[i21]
  T22 = T[i22]
  dist21 = abs(S2 - T21)
  dist22 = abs(S2 - T22)
  #print("dist21, dist22:", dist21, dist22)
  
  dist = min(dist1 + min(dist11, dist12), dist2 + min(dist21, dist22))
  answer = min(answer, dist)
  
  S, T = T, S
  A, B = B, A

  print(answer)



# Optimized solution
import bisect

A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
#print("S:", S)
#print("T:", T)

answer1 = []
answer2 = []

for x in X:
  
  answer = 10 ** 12
  
  i1 = bisect.bisect_right(S, x) - 1
  i2 = (i1 + 1) % A
  S1 = S[i1]
  S2 = S[i2]  
  dist1 = abs(x - S1)
  dist2 = abs(x - S2)
  #print("dist1, dist2:", dist1, dist2)
  
  i11 = bisect.bisect_right(T, S1) - 1
  i12 = (i11 + 1) % B
  T11 = T[i11]
  T12 = T[i12]
  dist11 = abs(S1 - T11)
  dist12 = abs(S1 - T12)
  #print("dist11, dist12:", dist11, dist12)
    
  i21 = bisect.bisect_right(T, S2) - 1
  i22 = (i21 + 1) % B
  T21 = T[i21]
  T22 = T[i22]
  dist21 = abs(S2 - T21)
  dist22 = abs(S2 - T22)
  #print("dist21, dist22:", dist21, dist22)
  
  dist = min(dist1 + min(dist11, dist12), dist2 + min(dist21, dist22))
  answer1.append(dist)
  
S, T = T, S
A, B = B, A

for x in X:
  
  answer = 10 ** 15

  i1 = bisect.bisect_right(S, x) - 1
  i2 = (i1 + 1) % A
  S1 = S[i1]
  S2 = S[i2]  
  dist1 = abs(x - S1)
  dist2 = abs(x - S2)
  #print("dist1, dist2:", dist1, dist2)
  
  i11 = bisect.bisect_right(T, S1) - 1
  i12 = (i11 + 1) % B
  T11 = T[i11]
  T12 = T[i12]
  dist11 = abs(S1 - T11)
  dist12 = abs(S1 - T12)
  #print("dist11, dist12:", dist11, dist12)
    
  i21 = bisect.bisect_right(T, S2) - 1
  i22 = (i21 + 1) % B
  T21 = T[i21]
  T22 = T[i22]
  dist21 = abs(S2 - T21)
  dist22 = abs(S2 - T22)
  #print("dist21, dist22:", dist21, dist22)
  
  dist = min(dist1 + min(dist11, dist12), dist2 + min(dist21, dist22))
  answer2.append(dist)

for i in range(Q):
  print((min(answer1[i], answer2[i])))