from bisect import *
A,B,Q=map(int,input().split())
INF=10**15
S=[-INF*10,-INF]
for i in range(A):
  S.append(int(input()))
S.append(INF)
S.append(INF*10)
T=[-INF*10,-INF]
for i in range(B):
  T.append(int(input()))
T.append(INF)
T.append(INF*10)
D,E,F,G,V,W,X,Y,Z,P=0,0,0,0,0,0,0,0,0,0
for i in range(Q):
  X=int(input())
  V=bisect_left(S,X)
  Y,Z=S[V-1],S[V]
  D,E=abs(X-Y),abs(X-Z)
  V,W=bisect_left(T,Y),bisect_left(T,Z)
  F,G=min(abs(Y-T[V-1]),abs(Y-T[V])),min(abs(Z-T[W-1]),abs(Z-T[W]))
  P=min(D+F,E+G)
  V=bisect_left(T,X)
  Y,Z=T[V-1],T[V]
  D,E=abs(X-Y),abs(X-Z)
  V,W=bisect_left(S,Y),bisect_left(S,Z)
  F,G=min(abs(Y-S[V-1]),abs(Y-S[V])),min(abs(Z-S[W-1]),abs(Z-S[W]))
  print(min(P,D+F,E+G)) from bisect import * A,B,Q=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q INF=10**15 INF 10**15 10 15 S=[-INF*10,-INF] S [-INF*10,-INF] -INF*10 -INF INF 10 -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 S.append(INF*10) S.append S append INF*10 INF 10 T=[-INF*10,-INF] T [-INF*10,-INF] -INF*10 -INF INF 10 -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 T.append(INF*10) T.append T append INF*10 INF 10 D,E,F,G,V,W,X,Y,Z,P=0,0,0,0,0,0,0,0,0,0 D 0 E 0 F 0 G 0 V 0 W 0 X 0 Y 0 Z 0 P 0 for i in range(Q):
  X=int(input())
  V=bisect_left(S,X)
  Y,Z=S[V-1],S[V]
  D,E=abs(X-Y),abs(X-Z)
  V,W=bisect_left(T,Y),bisect_left(T,Z)
  F,G=min(abs(Y-T[V-1]),abs(Y-T[V])),min(abs(Z-T[W-1]),abs(Z-T[W]))
  P=min(D+F,E+G)
  V=bisect_left(T,X)
  Y,Z=T[V-1],T[V]
  D,E=abs(X-Y),abs(X-Z)
  V,W=bisect_left(S,Y),bisect_left(S,Z)
  F,G=min(abs(Y-S[V-1]),abs(Y-S[V])),min(abs(Z-S[W-1]),abs(Z-S[W]))
  print(min(P,D+F,E+G)) i range(Q) range Q X=int(input()) X int(input()) int input() input V=bisect_left(S,X) V bisect_left(S,X) bisect_left S X Y,Z=S[V-1],S[V] Y S[V-1] S V-1 V 1 Z S[V] S V D,E=abs(X-Y),abs(X-Z) D abs(X-Y) abs X-Y X Y E abs(X-Z) abs X-Z X Z V,W=bisect_left(T,Y),bisect_left(T,Z) V bisect_left(T,Y) bisect_left T Y W bisect_left(T,Z) bisect_left T Z F,G=min(abs(Y-T[V-1]),abs(Y-T[V])),min(abs(Z-T[W-1]),abs(Z-T[W])) F min(abs(Y-T[V-1]),abs(Y-T[V])) min abs(Y-T[V-1]) abs Y-T[V-1] Y T[V-1] T V-1 V 1 abs(Y-T[V]) abs Y-T[V] Y T[V] T V G min(abs(Z-T[W-1]),abs(Z-T[W])) min abs(Z-T[W-1]) abs Z-T[W-1] Z T[W-1] T W-1 W 1 abs(Z-T[W]) abs Z-T[W] Z T[W] T W P=min(D+F,E+G) P min(D+F,E+G) min D+F D F E+G E G V=bisect_left(T,X) V bisect_left(T,X) bisect_left T X Y,Z=T[V-1],T[V] Y T[V-1] T V-1 V 1 Z T[V] T V D,E=abs(X-Y),abs(X-Z) D abs(X-Y) abs X-Y X Y E abs(X-Z) abs X-Z X Z V,W=bisect_left(S,Y),bisect_left(S,Z) V bisect_left(S,Y) bisect_left S Y W bisect_left(S,Z) bisect_left S Z F,G=min(abs(Y-S[V-1]),abs(Y-S[V])),min(abs(Z-S[W-1]),abs(Z-S[W])) F min(abs(Y-S[V-1]),abs(Y-S[V])) min abs(Y-S[V-1]) abs Y-S[V-1] Y S[V-1] S V-1 V 1 abs(Y-S[V]) abs Y-S[V] Y S[V] S V G min(abs(Z-S[W-1]),abs(Z-S[W])) min abs(Z-S[W-1]) abs Z-S[W-1] Z S[W-1] S W-1 W 1 abs(Z-S[W]) abs Z-S[W] Z S[W] S W print(min(P,D+F,E+G)) print min(P,D+F,E+G) min P D+F D F E+G E G G,V,W,X,Y,Z,P=0,0,0,0,0,0,0,0,0,0 0 G X=int(input()) int(input()) X Y,Z,P=0,0,0,0,0,0,0,0,0,0 0 Y A,B,Q=map(int,input().split()) map(int,input().split()) A F,G=min(abs(Y-T[V-1]),abs(Y-T[V])),min(abs(Z-T[W-1]),abs(Z-T[W])) min(abs(Y-T[V-1]),abs(Y-T[V])) F INF=10**15 10**15 INF V,W=bisect_left(S,Y),bisect_left(S,Z) bisect_left(S,Y) V G=min(abs(Y-S[V-1]),abs(Y-S[V])),min(abs(Z-S[W-1]),abs(Z-S[W])) min(abs(Z-S[W-1]),abs(Z-S[W])) G P=0,0,0,0,0,0,0,0,0,0 0 P E,F,G,V,W,X,Y,Z,P=0,0,0,0,0,0,0,0,0,0 0 E P=min(D+F,E+G) min(D+F,E+G) P F,G,V,W,X,Y,Z,P=0,0,0,0,0,0,0,0,0,0 0 F X,Y,Z,P=0,0,0,0,0,0,0,0,0,0 0 X Q=map(int,input().split()) map(int,input().split()) Q W,X,Y,Z,P=0,0,0,0,0,0,0,0,0,0 0 W D,E,F,G,V,W,X,Y,Z,P=0,0,0,0,0,0,0,0,0,0 0 D B,Q=map(int,input().split()) map(int,input().split()) B E=abs(X-Y),abs(X-Z) abs(X-Z) E Y,Z=T[V-1],T[V] T[V-1] Y E=abs(X-Y),abs(X-Z) abs(X-Z) E G=min(abs(Y-T[V-1]),abs(Y-T[V])),min(abs(Z-T[W-1]),abs(Z-T[W])) min(abs(Z-T[W-1]),abs(Z-T[W])) G S=[-INF*10,-INF] [-INF*10,-INF] S Z,P=0,0,0,0,0,0,0,0,0,0 0 Z W=bisect_left(S,Y),bisect_left(S,Z) bisect_left(S,Z) W T=[-INF*10,-INF] [-INF*10,-INF] T V,W,X,Y,Z,P=0,0,0,0,0,0,0,0,0,0 0 V W=bisect_left(T,Y),bisect_left(T,Z) bisect_left(T,Z) W Z=T[V-1],T[V] T[V] Z V=bisect_left(T,X) bisect_left(T,X) V Z=S[V-1],S[V] S[V] Z D,E=abs(X-Y),abs(X-Z) abs(X-Y) D V,W=bisect_left(T,Y),bisect_left(T,Z) bisect_left(T,Y) V Y,Z=S[V-1],S[V] S[V-1] Y V=bisect_left(S,X) bisect_left(S,X) V F,G=min(abs(Y-S[V-1]),abs(Y-S[V])),min(abs(Z-S[W-1]),abs(Z-S[W])) min(abs(Y-S[V-1]),abs(Y-S[V])) F D,E=abs(X-Y),abs(X-Z) abs(X-Y) D
from bisect import *
A,B,Q=map(int,input().split())
INF=10**15
S=[-INF*10,-INF]
for i in range(A):
  S.append(int(input()))
S.append(INF)
S.append(INF*10)
T=[-INF*10,-INF]
for i in range(B):
  T.append(int(input()))
T.append(INF)
T.append(INF*10)
D,E,F,G,V,W,X,Y,Z,P=0,0,0,0,0,0,0,0,0,0
for i in range(Q):
  X=int(input())
  V=bisect_left(S,X)
  Y,Z=S[V-1],S[V]
  D,E=abs(X-Y),abs(X-Z)
  V,W=bisect_left(T,Y),bisect_left(T,Z)
  F,G=min(abs(Y-T[V-1]),abs(Y-T[V])),min(abs(Z-T[W-1]),abs(Z-T[W]))
  P=min(D+F,E+G)
  V=bisect_left(T,X)
  Y,Z=T[V-1],T[V]
  D,E=abs(X-Y),abs(X-Z)
  V,W=bisect_left(S,Y),bisect_left(S,Z)
  F,G=min(abs(Y-S[V-1]),abs(Y-S[V])),min(abs(Z-S[W-1]),abs(Z-S[W]))
  print(min(P,D+F,E+G))