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())
  sh=S[bisect.bisect_left(S,x)]
  sl=S[bisect.bisect_left(S,x)-1]
  th=T[bisect.bisect_left(T,x)]
  tl=T[bisect.bisect_left(T,x)-1]
  a1=abs(x-sh)+abs(sh-th)
  a2=abs(x-sl)+abs(sl-th)
  a3=abs(x-sh)+abs(sh-tl)
  a4=abs(x-sl)+abs(sl-tl)
  a5=abs(x-th)+abs(th-sh)
  a6=abs(x-tl)+abs(tl-sh)
  a7=abs(x-th)+abs(th-sl)
  a8=abs(x-tl)+abs(tl-sl)
  print(min(a1,a2,a3,a4,a5,a6,a7,a8)) 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())
  sh=S[bisect.bisect_left(S,x)]
  sl=S[bisect.bisect_left(S,x)-1]
  th=T[bisect.bisect_left(T,x)]
  tl=T[bisect.bisect_left(T,x)-1]
  a1=abs(x-sh)+abs(sh-th)
  a2=abs(x-sl)+abs(sl-th)
  a3=abs(x-sh)+abs(sh-tl)
  a4=abs(x-sl)+abs(sl-tl)
  a5=abs(x-th)+abs(th-sh)
  a6=abs(x-tl)+abs(tl-sh)
  a7=abs(x-th)+abs(th-sl)
  a8=abs(x-tl)+abs(tl-sl)
  print(min(a1,a2,a3,a4,a5,a6,a7,a8)) i range(Q) range Q x=int(input()) x int(input()) int input() input sh=S[bisect.bisect_left(S,x)] sh S[bisect.bisect_left(S,x)] S bisect.bisect_left(S,x) bisect.bisect_left bisect bisect_left S x sl=S[bisect.bisect_left(S,x)-1] sl 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 th=T[bisect.bisect_left(T,x)] th T[bisect.bisect_left(T,x)] T bisect.bisect_left(T,x) bisect.bisect_left bisect bisect_left T x tl=T[bisect.bisect_left(T,x)-1] tl 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 a1=abs(x-sh)+abs(sh-th) a1 abs(x-sh)+abs(sh-th) abs(x-sh) abs x-sh x sh abs(sh-th) abs sh-th sh th a2=abs(x-sl)+abs(sl-th) a2 abs(x-sl)+abs(sl-th) abs(x-sl) abs x-sl x sl abs(sl-th) abs sl-th sl th a3=abs(x-sh)+abs(sh-tl) a3 abs(x-sh)+abs(sh-tl) abs(x-sh) abs x-sh x sh abs(sh-tl) abs sh-tl sh tl a4=abs(x-sl)+abs(sl-tl) a4 abs(x-sl)+abs(sl-tl) abs(x-sl) abs x-sl x sl abs(sl-tl) abs sl-tl sl tl a5=abs(x-th)+abs(th-sh) a5 abs(x-th)+abs(th-sh) abs(x-th) abs x-th x th abs(th-sh) abs th-sh th sh a6=abs(x-tl)+abs(tl-sh) a6 abs(x-tl)+abs(tl-sh) abs(x-tl) abs x-tl x tl abs(tl-sh) abs tl-sh tl sh a7=abs(x-th)+abs(th-sl) a7 abs(x-th)+abs(th-sl) abs(x-th) abs x-th x th abs(th-sl) abs th-sl th sl a8=abs(x-tl)+abs(tl-sl) a8 abs(x-tl)+abs(tl-sl) abs(x-tl) abs x-tl x tl abs(tl-sl) abs tl-sl tl sl print(min(a1,a2,a3,a4,a5,a6,a7,a8)) print min(a1,a2,a3,a4,a5,a6,a7,a8) min a1 a2 a3 a4 a5 a6 a7 a8 a1=abs(x-sh)+abs(sh-th) abs(x-sh)+abs(sh-th) a1 a5=abs(x-th)+abs(th-sh) abs(x-th)+abs(th-sh) a5 Q=map(int,input().split()) map(int,input().split()) Q a6=abs(x-tl)+abs(tl-sh) abs(x-tl)+abs(tl-sh) a6 th=T[bisect.bisect_left(T,x)] T[bisect.bisect_left(T,x)] th a7=abs(x-th)+abs(th-sl) abs(x-th)+abs(th-sl) a7 a4=abs(x-sl)+abs(sl-tl) abs(x-sl)+abs(sl-tl) a4 a3=abs(x-sh)+abs(sh-tl) abs(x-sh)+abs(sh-tl) a3 S=[-INF] [-INF] S INF=10**12 10**12 INF tl=T[bisect.bisect_left(T,x)-1] T[bisect.bisect_left(T,x)-1] tl a2=abs(x-sl)+abs(sl-th) abs(x-sl)+abs(sl-th) a2 a8=abs(x-tl)+abs(tl-sl) abs(x-tl)+abs(tl-sl) a8 sl=S[bisect.bisect_left(S,x)-1] S[bisect.bisect_left(S,x)-1] sl B,Q=map(int,input().split()) map(int,input().split()) B T=[-INF] [-INF] T sh=S[bisect.bisect_left(S,x)] S[bisect.bisect_left(S,x)] sh A,B,Q=map(int,input().split()) map(int,input().split()) A x=int(input()) int(input()) x
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())
  sh=S[bisect.bisect_left(S,x)]
  sl=S[bisect.bisect_left(S,x)-1]
  th=T[bisect.bisect_left(T,x)]
  tl=T[bisect.bisect_left(T,x)-1]
  a1=abs(x-sh)+abs(sh-th)
  a2=abs(x-sl)+abs(sl-th)
  a3=abs(x-sh)+abs(sh-tl)
  a4=abs(x-sl)+abs(sl-tl)
  a5=abs(x-th)+abs(th-sh)
  a6=abs(x-tl)+abs(tl-sh)
  a7=abs(x-th)+abs(th-sl)
  a8=abs(x-tl)+abs(tl-sl)
  print(min(a1,a2,a3,a4,a5,a6,a7,a8))