A,B,Q=map(int,input().split())
S=[int(input()) for i in range(A)]+[0,10**10+1]
T=[int(input()) for i in range(B)]+[0,10**10+1]
S=sorted(S)
T=sorted(T)
import bisect
for i in range(Q):
  x=int(input())
  si=bisect.bisect_left(S,x)
  if si==1:
    s1,s2=S[si],S[si]
  elif si==A+1:
    s1,s2=S[si-1],S[si-1]
  else:
    s1,s2=S[si-1],S[si]
  ti=bisect.bisect_left(T,x)
  if ti==1:
    t1,t2=T[ti],T[ti]
  elif ti==B+1:
    t1,t2=T[ti-1],T[ti-1]
  else:
    t1,t2=T[ti-1],T[ti]
  ans=min(abs(x-s1)+min(abs(s1-t1),abs(s1-t2)),
         abs(s2-x)+min(abs(s2-t1),abs(s2-t2)),
         abs(x-t1)+min(abs(t1-s1),abs(t1-s2)),
         abs(t2-x)+min(abs(t2-s1),abs(t2-s2)))
  print(ans) A,B,Q=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q int(input()) for i in range(A) for i in range(A) i range(A) range A for i in range(A) int(input()) int input() input S=[int(input()) for i in range(A)]+[0,10**10+1] S [int(input()) for i in range(A)]+[0,10**10+1] [int(input()) for i in range(A)] [0,10**10+1] 0 10**10+1 10**10 10 10 1 int(input()) for i in range(B) for i in range(B) i range(B) range B for i in range(B) int(input()) int input() input T=[int(input()) for i in range(B)]+[0,10**10+1] T [int(input()) for i in range(B)]+[0,10**10+1] [int(input()) for i in range(B)] [0,10**10+1] 0 10**10+1 10**10 10 10 1 S=sorted(S) S sorted(S) sorted S T=sorted(T) T sorted(T) sorted T import bisect bisect for i in range(Q):
  x=int(input())
  si=bisect.bisect_left(S,x)
  if si==1:
    s1,s2=S[si],S[si]
  elif si==A+1:
    s1,s2=S[si-1],S[si-1]
  else:
    s1,s2=S[si-1],S[si]
  ti=bisect.bisect_left(T,x)
  if ti==1:
    t1,t2=T[ti],T[ti]
  elif ti==B+1:
    t1,t2=T[ti-1],T[ti-1]
  else:
    t1,t2=T[ti-1],T[ti]
  ans=min(abs(x-s1)+min(abs(s1-t1),abs(s1-t2)),
         abs(s2-x)+min(abs(s2-t1),abs(s2-t2)),
         abs(x-t1)+min(abs(t1-s1),abs(t1-s2)),
         abs(t2-x)+min(abs(t2-s1),abs(t2-s2)))
  print(ans) i range(Q) range Q x=int(input()) x int(input()) int input() input si=bisect.bisect_left(S,x) si bisect.bisect_left(S,x) bisect.bisect_left bisect bisect_left S x if si==1:
    s1,s2=S[si],S[si]
  elif si==A+1:
    s1,s2=S[si-1],S[si-1]
  else:
    s1,s2=S[si-1],S[si]
   si==1 si 1 s1,s2=S[si],S[si] s1 S[si] S si s2 S[si] S si elif si==A+1:
    s1,s2=S[si-1],S[si-1]
   si==A+1 si A+1 A 1 s1,s2=S[si-1],S[si-1] s1 S[si-1] S si-1 si 1 s2 S[si-1] S si-1 si 1 s1,s2=S[si-1],S[si] s1 S[si-1] S si-1 si 1 s2 S[si] S si ti=bisect.bisect_left(T,x) ti bisect.bisect_left(T,x) bisect.bisect_left bisect bisect_left T x if ti==1:
    t1,t2=T[ti],T[ti]
  elif ti==B+1:
    t1,t2=T[ti-1],T[ti-1]
  else:
    t1,t2=T[ti-1],T[ti]
   ti==1 ti 1 t1,t2=T[ti],T[ti] t1 T[ti] T ti t2 T[ti] T ti elif ti==B+1:
    t1,t2=T[ti-1],T[ti-1]
   ti==B+1 ti B+1 B 1 t1,t2=T[ti-1],T[ti-1] t1 T[ti-1] T ti-1 ti 1 t2 T[ti-1] T ti-1 ti 1 t1,t2=T[ti-1],T[ti] t1 T[ti-1] T ti-1 ti 1 t2 T[ti] T ti ans=min(abs(x-s1)+min(abs(s1-t1),abs(s1-t2)),
         abs(s2-x)+min(abs(s2-t1),abs(s2-t2)),
         abs(x-t1)+min(abs(t1-s1),abs(t1-s2)),
         abs(t2-x)+min(abs(t2-s1),abs(t2-s2))) ans min(abs(x-s1)+min(abs(s1-t1),abs(s1-t2)),
         abs(s2-x)+min(abs(s2-t1),abs(s2-t2)),
         abs(x-t1)+min(abs(t1-s1),abs(t1-s2)),
         abs(t2-x)+min(abs(t2-s1),abs(t2-s2))) min abs(x-s1)+min(abs(s1-t1),abs(s1-t2)) abs(x-s1) abs x-s1 x s1 min(abs(s1-t1),abs(s1-t2)) min abs(s1-t1) abs s1-t1 s1 t1 abs(s1-t2) abs s1-t2 s1 t2 abs(s2-x)+min(abs(s2-t1),abs(s2-t2)) abs(s2-x) abs s2-x s2 x min(abs(s2-t1),abs(s2-t2)) min abs(s2-t1) abs s2-t1 s2 t1 abs(s2-t2) abs s2-t2 s2 t2 abs(x-t1)+min(abs(t1-s1),abs(t1-s2)) abs(x-t1) abs x-t1 x t1 min(abs(t1-s1),abs(t1-s2)) min abs(t1-s1) abs t1-s1 t1 s1 abs(t1-s2) abs t1-s2 t1 s2 abs(t2-x)+min(abs(t2-s1),abs(t2-s2)) abs(t2-x) abs t2-x t2 x min(abs(t2-s1),abs(t2-s2)) min abs(t2-s1) abs t2-s1 t2 s1 abs(t2-s2) abs t2-s2 t2 s2 print(ans) print ans s1,s2=S[si-1],S[si] S[si-1] s1 s2=S[si-1],S[si-1] S[si-1] s2 x=int(input()) int(input()) x t1,t2=T[ti-1],T[ti] T[ti-1] t1 t2=T[ti-1],T[ti] T[ti] t2 s1,s2=S[si-1],S[si-1] S[si-1] s1 t2=T[ti],T[ti] T[ti] t2 A,B,Q=map(int,input().split()) map(int,input().split()) A si=bisect.bisect_left(S,x) bisect.bisect_left(S,x) si s2=S[si-1],S[si] S[si] s2 ti=bisect.bisect_left(T,x) bisect.bisect_left(T,x) ti T=sorted(T) sorted(T) T t2=T[ti-1],T[ti-1] T[ti-1] t2 t1,t2=T[ti-1],T[ti-1] T[ti-1] t1 s1,s2=S[si],S[si] S[si] s1 T=[int(input()) for i in range(B)]+[0,10**10+1] [int(input()) for i in range(B)]+[0,10**10+1] T S=sorted(S) sorted(S) S Q=map(int,input().split()) map(int,input().split()) Q S=[int(input()) for i in range(A)]+[0,10**10+1] [int(input()) for i in range(A)]+[0,10**10+1] S s2=S[si],S[si] S[si] s2 ans=min(abs(x-s1)+min(abs(s1-t1),abs(s1-t2)),
         abs(s2-x)+min(abs(s2-t1),abs(s2-t2)),
         abs(x-t1)+min(abs(t1-s1),abs(t1-s2)),
         abs(t2-x)+min(abs(t2-s1),abs(t2-s2))) min(abs(x-s1)+min(abs(s1-t1),abs(s1-t2)),
         abs(s2-x)+min(abs(s2-t1),abs(s2-t2)),
         abs(x-t1)+min(abs(t1-s1),abs(t1-s2)),
         abs(t2-x)+min(abs(t2-s1),abs(t2-s2))) ans B,Q=map(int,input().split()) map(int,input().split()) B t1,t2=T[ti],T[ti] T[ti] t1
A,B,Q=map(int,input().split())
S=[int(input()) for i in range(A)]+[0,10**10+1]
T=[int(input()) for i in range(B)]+[0,10**10+1]
S=sorted(S)
T=sorted(T)
import bisect
for i in range(Q):
  x=int(input())
  si=bisect.bisect_left(S,x)
  if si==1:
    s1,s2=S[si],S[si]
  elif si==A+1:
    s1,s2=S[si-1],S[si-1]
  else:
    s1,s2=S[si-1],S[si]
  ti=bisect.bisect_left(T,x)
  if ti==1:
    t1,t2=T[ti],T[ti]
  elif ti==B+1:
    t1,t2=T[ti-1],T[ti-1]
  else:
    t1,t2=T[ti-1],T[ti]
  ans=min(abs(x-s1)+min(abs(s1-t1),abs(s1-t2)),
         abs(s2-x)+min(abs(s2-t1),abs(s2-t2)),
         abs(x-t1)+min(abs(t1-s1),abs(t1-s2)),
         abs(t2-x)+min(abs(t2-s1),abs(t2-s2)))
  print(ans)