#119_D
A,B,Q=map(int,input().split())
INF=10**15
S=[-INF]+[int(input()) for _ in range(A)]+[INF]
T=[-INF]+[int(input()) for _ in range(B)]+[INF]

from bisect import bisect_left

for _ in range(Q):
    x=int(input())
    s=bisect_left(S,x)
    t=bisect_left(T,x)
    
    sr=abs(S[s]-x)
    sl=abs(S[s-1]-x)
    tr=abs(T[t]-x)
    tl=abs(T[t-1]-x)
    
    Ans=min(max(sr,tr),max(sl,tl),2*sr+tl,sr+2*tl,2*tr+sl,tr+2*sl)
    
    print(Ans) 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 int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input S=[-INF]+[int(input()) for _ in range(A)]+[INF] S [-INF]+[int(input()) for _ in range(A)]+[INF] [-INF]+[int(input()) for _ in range(A)] [-INF] -INF INF [int(input()) for _ in range(A)] [INF] INF int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input T=[-INF]+[int(input()) for _ in range(B)]+[INF] T [-INF]+[int(input()) for _ in range(B)]+[INF] [-INF]+[int(input()) for _ in range(B)] [-INF] -INF INF [int(input()) for _ in range(B)] [INF] INF from bisect import bisect_left for _ in range(Q):
    x=int(input())
    s=bisect_left(S,x)
    t=bisect_left(T,x)
    
    sr=abs(S[s]-x)
    sl=abs(S[s-1]-x)
    tr=abs(T[t]-x)
    tl=abs(T[t-1]-x)
    
    Ans=min(max(sr,tr),max(sl,tl),2*sr+tl,sr+2*tl,2*tr+sl,tr+2*sl)
    
    print(Ans) _ range(Q) range Q x=int(input()) x int(input()) int input() input s=bisect_left(S,x) s bisect_left(S,x) bisect_left S x t=bisect_left(T,x) t bisect_left(T,x) bisect_left T x sr=abs(S[s]-x) sr abs(S[s]-x) abs S[s]-x S[s] S s x sl=abs(S[s-1]-x) sl abs(S[s-1]-x) abs S[s-1]-x S[s-1] S s-1 s 1 x tr=abs(T[t]-x) tr abs(T[t]-x) abs T[t]-x T[t] T t x tl=abs(T[t-1]-x) tl abs(T[t-1]-x) abs T[t-1]-x T[t-1] T t-1 t 1 x Ans=min(max(sr,tr),max(sl,tl),2*sr+tl,sr+2*tl,2*tr+sl,tr+2*sl) Ans min(max(sr,tr),max(sl,tl),2*sr+tl,sr+2*tl,2*tr+sl,tr+2*sl) min max(sr,tr) max sr tr max(sl,tl) max sl tl 2*sr+tl 2*sr 2 sr tl sr+2*tl sr 2*tl 2 tl 2*tr+sl 2*tr 2 tr sl tr+2*sl tr 2*sl 2 sl print(Ans) print Ans tr=abs(T[t]-x) abs(T[t]-x) tr Q=map(int,input().split()) map(int,input().split()) Q INF=10**15 10**15 INF t=bisect_left(T,x) bisect_left(T,x) t A,B,Q=map(int,input().split()) map(int,input().split()) A S=[-INF]+[int(input()) for _ in range(A)]+[INF] [-INF]+[int(input()) for _ in range(A)]+[INF] S T=[-INF]+[int(input()) for _ in range(B)]+[INF] [-INF]+[int(input()) for _ in range(B)]+[INF] T B,Q=map(int,input().split()) map(int,input().split()) B s=bisect_left(S,x) bisect_left(S,x) s sl=abs(S[s-1]-x) abs(S[s-1]-x) sl sr=abs(S[s]-x) abs(S[s]-x) sr x=int(input()) int(input()) x tl=abs(T[t-1]-x) abs(T[t-1]-x) tl Ans=min(max(sr,tr),max(sl,tl),2*sr+tl,sr+2*tl,2*tr+sl,tr+2*sl) min(max(sr,tr),max(sl,tl),2*sr+tl,sr+2*tl,2*tr+sl,tr+2*sl) Ans
#119_D
A,B,Q=map(int,input().split())
INF=10**15
S=[-INF]+[int(input()) for _ in range(A)]+[INF]
T=[-INF]+[int(input()) for _ in range(B)]+[INF]

from bisect import bisect_left

for _ in range(Q):
    x=int(input())
    s=bisect_left(S,x)
    t=bisect_left(T,x)
    
    sr=abs(S[s]-x)
    sl=abs(S[s-1]-x)
    tr=abs(T[t]-x)
    tl=abs(T[t-1]-x)
    
    Ans=min(max(sr,tr),max(sl,tl),2*sr+tl,sr+2*tl,2*tr+sl,tr+2*sl)
    
    print(Ans)