from bisect import bisect_left

A,B,Q=list(map(int,input().split()))
s=[-10**11]+[int(input()) for _ in range(A)]+[10**11]
t=[-10**11]+[int(input()) for _ in range(B)]+[10**11]
x=[int(input()) for _ in range(Q)]


for xi in x:
    p1=bisect_left(s,xi)
    p2=bisect_left(t,xi)
    l=10**11
    for ss in s[p1-1:p1+1]:
        for tt in t[p2-1:p2+1]:
            l=min(l,min(abs(ss-xi),abs(tt-xi))+abs(ss-tt))
    
    print(l) from bisect import bisect_left A,B,Q=list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split B Q int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input s=[-10**11]+[int(input()) for _ in range(A)]+[10**11] s [-10**11]+[int(input()) for _ in range(A)]+[10**11] [-10**11]+[int(input()) for _ in range(A)] [-10**11] -10**11 -10 11 [int(input()) for _ in range(A)] [10**11] 10**11 10 11 int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input t=[-10**11]+[int(input()) for _ in range(B)]+[10**11] t [-10**11]+[int(input()) for _ in range(B)]+[10**11] [-10**11]+[int(input()) for _ in range(B)] [-10**11] -10**11 -10 11 [int(input()) for _ in range(B)] [10**11] 10**11 10 11 int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input x=[int(input()) for _ in range(Q)] x [int(input()) for _ in range(Q)] for xi in x:
    p1=bisect_left(s,xi)
    p2=bisect_left(t,xi)
    l=10**11
    for ss in s[p1-1:p1+1]:
        for tt in t[p2-1:p2+1]:
            l=min(l,min(abs(ss-xi),abs(tt-xi))+abs(ss-tt))
    
    print(l) xi x p1=bisect_left(s,xi) p1 bisect_left(s,xi) bisect_left s xi p2=bisect_left(t,xi) p2 bisect_left(t,xi) bisect_left t xi l=10**11 l 10**11 10 11 for ss in s[p1-1:p1+1]:
        for tt in t[p2-1:p2+1]:
            l=min(l,min(abs(ss-xi),abs(tt-xi))+abs(ss-tt))
    
     ss s[p1-1:p1+1] s p1-1:p1+1 p1-1 p1 1 p1+1 p1 1 for tt in t[p2-1:p2+1]:
            l=min(l,min(abs(ss-xi),abs(tt-xi))+abs(ss-tt))
    
     tt t[p2-1:p2+1] t p2-1:p2+1 p2-1 p2 1 p2+1 p2 1 l=min(l,min(abs(ss-xi),abs(tt-xi))+abs(ss-tt)) l min(l,min(abs(ss-xi),abs(tt-xi))+abs(ss-tt)) min l min(abs(ss-xi),abs(tt-xi))+abs(ss-tt) min(abs(ss-xi),abs(tt-xi)) min abs(ss-xi) abs ss-xi ss xi abs(tt-xi) abs tt-xi tt xi abs(ss-tt) abs ss-tt ss tt print(l) print l B,Q=list(map(int,input().split())) list(map(int,input().split())) B s=[-10**11]+[int(input()) for _ in range(A)]+[10**11] [-10**11]+[int(input()) for _ in range(A)]+[10**11] s l=10**11 10**11 l Q=list(map(int,input().split())) list(map(int,input().split())) Q t=[-10**11]+[int(input()) for _ in range(B)]+[10**11] [-10**11]+[int(input()) for _ in range(B)]+[10**11] t A,B,Q=list(map(int,input().split())) list(map(int,input().split())) A p1=bisect_left(s,xi) bisect_left(s,xi) p1 p2=bisect_left(t,xi) bisect_left(t,xi) p2 x=[int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] x l=min(l,min(abs(ss-xi),abs(tt-xi))+abs(ss-tt)) min(l,min(abs(ss-xi),abs(tt-xi))+abs(ss-tt)) l
from bisect import bisect_left

A,B,Q=list(map(int,input().split()))
s=[-10**11]+[int(input()) for _ in range(A)]+[10**11]
t=[-10**11]+[int(input()) for _ in range(B)]+[10**11]
x=[int(input()) for _ in range(Q)]


for xi in x:
    p1=bisect_left(s,xi)
    p2=bisect_left(t,xi)
    l=10**11
    for ss in s[p1-1:p1+1]:
        for tt in t[p2-1:p2+1]:
            l=min(l,min(abs(ss-xi),abs(tt-xi))+abs(ss-tt))
    
    print(l)
