import bisect
A,B,Q=map(int,input().split())
INF=10**12
S=[-INF]
for i in range(A):
  S.append(int(input()))
S.append(INF)
T=[-INF]
for i in range(B):
  T.append(int(input()))
T.append(INF)
for i in range(Q):
  x=int(input())
  sl=[S[bisect.bisect_left(S,x)],S[bisect.bisect_left(S,x)-1]]
  tl=[T[bisect.bisect_left(T,x)],T[bisect.bisect_left(T,x)-1]]
  ans=[]
  for s in sl:
    for t in tl:
      ans.append(abs(x-s)+abs(s-t))
      ans.append(abs(x-t)+abs(t-s))
  print(min(ans)) import bisect bisect A,B,Q=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q INF=10**12 INF 10**12 10 12 S=[-INF] S [-INF] -INF INF for i in range(A):
  S.append(int(input())) i range(A) range A S.append(int(input())) S.append S append int(input()) int input() input S.append(INF) S.append S append INF T=[-INF] T [-INF] -INF INF for i in range(B):
  T.append(int(input())) i range(B) range B T.append(int(input())) T.append T append int(input()) int input() input T.append(INF) T.append T append INF for i in range(Q):
  x=int(input())
  sl=[S[bisect.bisect_left(S,x)],S[bisect.bisect_left(S,x)-1]]
  tl=[T[bisect.bisect_left(T,x)],T[bisect.bisect_left(T,x)-1]]
  ans=[]
  for s in sl:
    for t in tl:
      ans.append(abs(x-s)+abs(s-t))
      ans.append(abs(x-t)+abs(t-s))
  print(min(ans)) i range(Q) range Q x=int(input()) x int(input()) int input() input sl=[S[bisect.bisect_left(S,x)],S[bisect.bisect_left(S,x)-1]] sl [S[bisect.bisect_left(S,x)],S[bisect.bisect_left(S,x)-1]] S[bisect.bisect_left(S,x)] S bisect.bisect_left(S,x) bisect.bisect_left bisect bisect_left S x S[bisect.bisect_left(S,x)-1] S bisect.bisect_left(S,x)-1 bisect.bisect_left(S,x) bisect.bisect_left bisect bisect_left S x 1 tl=[T[bisect.bisect_left(T,x)],T[bisect.bisect_left(T,x)-1]] tl [T[bisect.bisect_left(T,x)],T[bisect.bisect_left(T,x)-1]] T[bisect.bisect_left(T,x)] T bisect.bisect_left(T,x) bisect.bisect_left bisect bisect_left T x T[bisect.bisect_left(T,x)-1] T bisect.bisect_left(T,x)-1 bisect.bisect_left(T,x) bisect.bisect_left bisect bisect_left T x 1 ans=[] ans [] for s in sl:
    for t in tl:
      ans.append(abs(x-s)+abs(s-t))
      ans.append(abs(x-t)+abs(t-s))
   s sl for t in tl:
      ans.append(abs(x-s)+abs(s-t))
      ans.append(abs(x-t)+abs(t-s))
   t tl ans.append(abs(x-s)+abs(s-t)) ans.append ans append abs(x-s)+abs(s-t) abs(x-s) abs x-s x s abs(s-t) abs s-t s t ans.append(abs(x-t)+abs(t-s)) ans.append ans append abs(x-t)+abs(t-s) abs(x-t) abs x-t x t abs(t-s) abs t-s t s print(min(ans)) print min(ans) min ans B,Q=map(int,input().split()) map(int,input().split()) B x=int(input()) int(input()) x tl=[T[bisect.bisect_left(T,x)],T[bisect.bisect_left(T,x)-1]] [T[bisect.bisect_left(T,x)],T[bisect.bisect_left(T,x)-1]] tl A,B,Q=map(int,input().split()) map(int,input().split()) A S=[-INF] [-INF] S INF=10**12 10**12 INF T=[-INF] [-INF] T sl=[S[bisect.bisect_left(S,x)],S[bisect.bisect_left(S,x)-1]] [S[bisect.bisect_left(S,x)],S[bisect.bisect_left(S,x)-1]] sl Q=map(int,input().split()) map(int,input().split()) Q ans=[] [] ans
import bisect
A,B,Q=map(int,input().split())
INF=10**12
S=[-INF]
for i in range(A):
  S.append(int(input()))
S.append(INF)
T=[-INF]
for i in range(B):
  T.append(int(input()))
T.append(INF)
for i in range(Q):
  x=int(input())
  sl=[S[bisect.bisect_left(S,x)],S[bisect.bisect_left(S,x)-1]]
  tl=[T[bisect.bisect_left(T,x)],T[bisect.bisect_left(T,x)-1]]
  ans=[]
  for s in sl:
    for t in tl:
      ans.append(abs(x-s)+abs(s-t))
      ans.append(abs(x-t)+abs(t-s))
  print(min(ans))