from bisect import bisect_left

A,B,Q=map(int,input().split())
S=[int(input()) for i in range(A)]
T=[int(input()) for i in range(B)]
for i in range(Q):
    x=int(input())
    si=bisect_left(S,x)
    ti=bisect_left(T,x)
    if 0<si<A and 0<ti<B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),max(sl,tl),sl+tr+min(sl,tr),sr+tl+min(sr,tl)))
    elif si==0 and ti==0:
        sr=abs(x-S[si])
        tr=abs(x-T[ti])
        print(max(sr,tr))
    elif si==A and ti==B:
        sl=abs(x-S[si-1])
        tl=abs(x-T[ti-1])
        print(max(sl,tl))
    elif si==0 and ti==B:
        sr=abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(sr+tl+min(sr,tl))
    elif si==A and ti==0:
        sl=abs(x-S[si-1])
        tr=abs(x-T[ti])
        print(sl+tr+min(sl,tr))
    elif si==0:
        sr=abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),sr+tl+min(sr,tl)))
    elif si==A:
        sl=abs(x-S[si-1])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sl,tl),sl+tr+min(sl,tr)))
    elif ti==0:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tr=abs(x-T[ti])
        print(min(max(sr,tr),sl+tr+min(sl,tr)))
    elif ti==B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(min(max(sl,tl),sr+tl+min(sr,tl))) from bisect import bisect_left 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)] S [int(input()) for i in range(A)] 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)] T [int(input()) for i in range(B)] for i in range(Q):
    x=int(input())
    si=bisect_left(S,x)
    ti=bisect_left(T,x)
    if 0<si<A and 0<ti<B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),max(sl,tl),sl+tr+min(sl,tr),sr+tl+min(sr,tl)))
    elif si==0 and ti==0:
        sr=abs(x-S[si])
        tr=abs(x-T[ti])
        print(max(sr,tr))
    elif si==A and ti==B:
        sl=abs(x-S[si-1])
        tl=abs(x-T[ti-1])
        print(max(sl,tl))
    elif si==0 and ti==B:
        sr=abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(sr+tl+min(sr,tl))
    elif si==A and ti==0:
        sl=abs(x-S[si-1])
        tr=abs(x-T[ti])
        print(sl+tr+min(sl,tr))
    elif si==0:
        sr=abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),sr+tl+min(sr,tl)))
    elif si==A:
        sl=abs(x-S[si-1])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sl,tl),sl+tr+min(sl,tr)))
    elif ti==0:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tr=abs(x-T[ti])
        print(min(max(sr,tr),sl+tr+min(sl,tr)))
    elif ti==B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(min(max(sl,tl),sr+tl+min(sr,tl))) i range(Q) range Q x=int(input()) x int(input()) int input() input si=bisect_left(S,x) si bisect_left(S,x) bisect_left S x ti=bisect_left(T,x) ti bisect_left(T,x) bisect_left T x if 0<si<A and 0<ti<B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),max(sl,tl),sl+tr+min(sl,tr),sr+tl+min(sr,tl)))
    elif si==0 and ti==0:
        sr=abs(x-S[si])
        tr=abs(x-T[ti])
        print(max(sr,tr))
    elif si==A and ti==B:
        sl=abs(x-S[si-1])
        tl=abs(x-T[ti-1])
        print(max(sl,tl))
    elif si==0 and ti==B:
        sr=abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(sr+tl+min(sr,tl))
    elif si==A and ti==0:
        sl=abs(x-S[si-1])
        tr=abs(x-T[ti])
        print(sl+tr+min(sl,tr))
    elif si==0:
        sr=abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),sr+tl+min(sr,tl)))
    elif si==A:
        sl=abs(x-S[si-1])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sl,tl),sl+tr+min(sl,tr)))
    elif ti==0:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tr=abs(x-T[ti])
        print(min(max(sr,tr),sl+tr+min(sl,tr)))
    elif ti==B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(min(max(sl,tl),sr+tl+min(sr,tl))) 0<si<A and 0<ti<B 0<si<A 0<si 0 si A 0<ti<B 0<ti 0 ti B sl,sr=abs(x-S[si-1]),abs(x-S[si]) sl abs(x-S[si-1]) abs x-S[si-1] x S[si-1] S si-1 si 1 sr abs(x-S[si]) abs x-S[si] x S[si] S si tl,tr=abs(x-T[ti-1]),abs(x-T[ti]) tl abs(x-T[ti-1]) abs x-T[ti-1] x T[ti-1] T ti-1 ti 1 tr abs(x-T[ti]) abs x-T[ti] x T[ti] T ti print(min(max(sr,tr),max(sl,tl),sl+tr+min(sl,tr),sr+tl+min(sr,tl))) print min(max(sr,tr),max(sl,tl),sl+tr+min(sl,tr),sr+tl+min(sr,tl)) min max(sr,tr) max sr tr max(sl,tl) max sl tl sl+tr+min(sl,tr) sl+tr sl tr min(sl,tr) min sl tr sr+tl+min(sr,tl) sr+tl sr tl min(sr,tl) min sr tl elif si==0 and ti==0:
        sr=abs(x-S[si])
        tr=abs(x-T[ti])
        print(max(sr,tr))
     si==0 and ti==0 si==0 si 0 ti==0 ti 0 sr=abs(x-S[si]) sr abs(x-S[si]) abs x-S[si] x S[si] S si tr=abs(x-T[ti]) tr abs(x-T[ti]) abs x-T[ti] x T[ti] T ti print(max(sr,tr)) print max(sr,tr) max sr tr elif si==A and ti==B:
        sl=abs(x-S[si-1])
        tl=abs(x-T[ti-1])
        print(max(sl,tl))
     si==A and ti==B si==A si A ti==B ti B sl=abs(x-S[si-1]) sl abs(x-S[si-1]) abs x-S[si-1] x S[si-1] S si-1 si 1 tl=abs(x-T[ti-1]) tl abs(x-T[ti-1]) abs x-T[ti-1] x T[ti-1] T ti-1 ti 1 print(max(sl,tl)) print max(sl,tl) max sl tl elif si==0 and ti==B:
        sr=abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(sr+tl+min(sr,tl))
     si==0 and ti==B si==0 si 0 ti==B ti B sr=abs(x-S[si]) sr abs(x-S[si]) abs x-S[si] x S[si] S si tl=abs(x-T[ti-1]) tl abs(x-T[ti-1]) abs x-T[ti-1] x T[ti-1] T ti-1 ti 1 print(sr+tl+min(sr,tl)) print sr+tl+min(sr,tl) sr+tl sr tl min(sr,tl) min sr tl elif si==A and ti==0:
        sl=abs(x-S[si-1])
        tr=abs(x-T[ti])
        print(sl+tr+min(sl,tr))
     si==A and ti==0 si==A si A ti==0 ti 0 sl=abs(x-S[si-1]) sl abs(x-S[si-1]) abs x-S[si-1] x S[si-1] S si-1 si 1 tr=abs(x-T[ti]) tr abs(x-T[ti]) abs x-T[ti] x T[ti] T ti print(sl+tr+min(sl,tr)) print sl+tr+min(sl,tr) sl+tr sl tr min(sl,tr) min sl tr elif si==0:
        sr=abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),sr+tl+min(sr,tl)))
     si==0 si 0 sr=abs(x-S[si]) sr abs(x-S[si]) abs x-S[si] x S[si] S si tl,tr=abs(x-T[ti-1]),abs(x-T[ti]) tl abs(x-T[ti-1]) abs x-T[ti-1] x T[ti-1] T ti-1 ti 1 tr abs(x-T[ti]) abs x-T[ti] x T[ti] T ti print(min(max(sr,tr),sr+tl+min(sr,tl))) print min(max(sr,tr),sr+tl+min(sr,tl)) min max(sr,tr) max sr tr sr+tl+min(sr,tl) sr+tl sr tl min(sr,tl) min sr tl elif si==A:
        sl=abs(x-S[si-1])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sl,tl),sl+tr+min(sl,tr)))
     si==A si A sl=abs(x-S[si-1]) sl abs(x-S[si-1]) abs x-S[si-1] x S[si-1] S si-1 si 1 tl,tr=abs(x-T[ti-1]),abs(x-T[ti]) tl abs(x-T[ti-1]) abs x-T[ti-1] x T[ti-1] T ti-1 ti 1 tr abs(x-T[ti]) abs x-T[ti] x T[ti] T ti print(min(max(sl,tl),sl+tr+min(sl,tr))) print min(max(sl,tl),sl+tr+min(sl,tr)) min max(sl,tl) max sl tl sl+tr+min(sl,tr) sl+tr sl tr min(sl,tr) min sl tr elif ti==0:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tr=abs(x-T[ti])
        print(min(max(sr,tr),sl+tr+min(sl,tr)))
     ti==0 ti 0 sl,sr=abs(x-S[si-1]),abs(x-S[si]) sl abs(x-S[si-1]) abs x-S[si-1] x S[si-1] S si-1 si 1 sr abs(x-S[si]) abs x-S[si] x S[si] S si tr=abs(x-T[ti]) tr abs(x-T[ti]) abs x-T[ti] x T[ti] T ti print(min(max(sr,tr),sl+tr+min(sl,tr))) print min(max(sr,tr),sl+tr+min(sl,tr)) min max(sr,tr) max sr tr sl+tr+min(sl,tr) sl+tr sl tr min(sl,tr) min sl tr elif ti==B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(min(max(sl,tl),sr+tl+min(sr,tl))) ti==B ti B sl,sr=abs(x-S[si-1]),abs(x-S[si]) sl abs(x-S[si-1]) abs x-S[si-1] x S[si-1] S si-1 si 1 sr abs(x-S[si]) abs x-S[si] x S[si] S si tl=abs(x-T[ti-1]) tl abs(x-T[ti-1]) abs x-T[ti-1] x T[ti-1] T ti-1 ti 1 print(min(max(sl,tl),sr+tl+min(sr,tl))) print min(max(sl,tl),sr+tl+min(sr,tl)) min max(sl,tl) max sl tl sr+tl+min(sr,tl) sr+tl sr tl min(sr,tl) min sr tl sr=abs(x-S[si-1]),abs(x-S[si]) abs(x-S[si]) sr tr=abs(x-T[ti]) abs(x-T[ti]) tr sr=abs(x-S[si-1]),abs(x-S[si]) abs(x-S[si]) sr A,B,Q=map(int,input().split()) map(int,input().split()) A tr=abs(x-T[ti]) abs(x-T[ti]) tr tr=abs(x-T[ti-1]),abs(x-T[ti]) abs(x-T[ti]) tr x=int(input()) int(input()) x tl=abs(x-T[ti-1]) abs(x-T[ti-1]) tl tl,tr=abs(x-T[ti-1]),abs(x-T[ti]) abs(x-T[ti-1]) tl tr=abs(x-T[ti]) abs(x-T[ti]) tr sl,sr=abs(x-S[si-1]),abs(x-S[si]) abs(x-S[si-1]) sl tl,tr=abs(x-T[ti-1]),abs(x-T[ti]) abs(x-T[ti-1]) tl si=bisect_left(S,x) bisect_left(S,x) si sl=abs(x-S[si-1]) abs(x-S[si-1]) sl T=[int(input()) for i in range(B)] [int(input()) for i in range(B)] T sl=abs(x-S[si-1]) abs(x-S[si-1]) sl tl=abs(x-T[ti-1]) abs(x-T[ti-1]) tl sl,sr=abs(x-S[si-1]),abs(x-S[si]) abs(x-S[si-1]) sl sr=abs(x-S[si]) abs(x-S[si]) sr tr=abs(x-T[ti-1]),abs(x-T[ti]) abs(x-T[ti]) tr Q=map(int,input().split()) map(int,input().split()) Q S=[int(input()) for i in range(A)] [int(input()) for i in range(A)] S ti=bisect_left(T,x) bisect_left(T,x) ti tr=abs(x-T[ti-1]),abs(x-T[ti]) abs(x-T[ti]) tr sr=abs(x-S[si]) abs(x-S[si]) sr sr=abs(x-S[si-1]),abs(x-S[si]) abs(x-S[si]) sr sl,sr=abs(x-S[si-1]),abs(x-S[si]) abs(x-S[si-1]) sl sr=abs(x-S[si]) abs(x-S[si]) sr tl=abs(x-T[ti-1]) abs(x-T[ti-1]) tl sl=abs(x-S[si-1]) abs(x-S[si-1]) sl tl,tr=abs(x-T[ti-1]),abs(x-T[ti]) abs(x-T[ti-1]) tl B,Q=map(int,input().split()) map(int,input().split()) B
from bisect import bisect_left

A,B,Q=map(int,input().split())
S=[int(input()) for i in range(A)]
T=[int(input()) for i in range(B)]
for i in range(Q):
    x=int(input())
    si=bisect_left(S,x)
    ti=bisect_left(T,x)
    if 0<si<A and 0<ti<B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),max(sl,tl),sl+tr+min(sl,tr),sr+tl+min(sr,tl)))
    elif si==0 and ti==0:
        sr=abs(x-S[si])
        tr=abs(x-T[ti])
        print(max(sr,tr))
    elif si==A and ti==B:
        sl=abs(x-S[si-1])
        tl=abs(x-T[ti-1])
        print(max(sl,tl))
    elif si==0 and ti==B:
        sr=abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(sr+tl+min(sr,tl))
    elif si==A and ti==0:
        sl=abs(x-S[si-1])
        tr=abs(x-T[ti])
        print(sl+tr+min(sl,tr))
    elif si==0:
        sr=abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),sr+tl+min(sr,tl)))
    elif si==A:
        sl=abs(x-S[si-1])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sl,tl),sl+tr+min(sl,tr)))
    elif ti==0:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tr=abs(x-T[ti])
        print(min(max(sr,tr),sl+tr+min(sl,tr)))
    elif ti==B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(min(max(sl,tl),sr+tl+min(sr,tl)))