a,b,q = map(int, input().split())
inf=10**18
s=[-inf]+[int(input()) for _ in range(a)]+[inf]
t=[-inf]+[int(input()) for _ in range(b)]+[inf]
x=[int(input()) for _ in range(q)]
from bisect import bisect_left,bisect_right
for i in range(q):
    idx_s=bisect_right(s,x[i])
    idx_t=bisect_right(t,x[i])
    ans=inf
    for ss in [s[idx_s-1],s[idx_s]]:
        for tt in [t[idx_t-1],t[idx_t]]:
            d1,d2=abs(ss-x[i])+abs(ss-tt),abs(tt-x[i])+abs(tt-ss)
            ans=min(ans,d1,d2)
    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**18 inf 10**18 10 18 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 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)] from bisect import bisect_left,bisect_right for i in range(q):
    idx_s=bisect_right(s,x[i])
    idx_t=bisect_right(t,x[i])
    ans=inf
    for ss in [s[idx_s-1],s[idx_s]]:
        for tt in [t[idx_t-1],t[idx_t]]:
            d1,d2=abs(ss-x[i])+abs(ss-tt),abs(tt-x[i])+abs(tt-ss)
            ans=min(ans,d1,d2)
    print(ans) i range(q) range q idx_s=bisect_right(s,x[i]) idx_s bisect_right(s,x[i]) bisect_right s x[i] x i idx_t=bisect_right(t,x[i]) idx_t bisect_right(t,x[i]) bisect_right t x[i] x i ans=inf ans inf for ss in [s[idx_s-1],s[idx_s]]:
        for tt in [t[idx_t-1],t[idx_t]]:
            d1,d2=abs(ss-x[i])+abs(ss-tt),abs(tt-x[i])+abs(tt-ss)
            ans=min(ans,d1,d2)
     ss [s[idx_s-1],s[idx_s]] s[idx_s-1] s idx_s-1 idx_s 1 s[idx_s] s idx_s for tt in [t[idx_t-1],t[idx_t]]:
            d1,d2=abs(ss-x[i])+abs(ss-tt),abs(tt-x[i])+abs(tt-ss)
            ans=min(ans,d1,d2)
     tt [t[idx_t-1],t[idx_t]] t[idx_t-1] t idx_t-1 idx_t 1 t[idx_t] t idx_t d1,d2=abs(ss-x[i])+abs(ss-tt),abs(tt-x[i])+abs(tt-ss) d1 abs(ss-x[i])+abs(ss-tt) abs(ss-x[i]) abs ss-x[i] ss x[i] x i abs(ss-tt) abs ss-tt ss tt d2 abs(tt-x[i])+abs(tt-ss) abs(tt-x[i]) abs tt-x[i] tt x[i] x i abs(tt-ss) abs tt-ss tt ss ans=min(ans,d1,d2) ans min(ans,d1,d2) min ans d1 d2 print(ans) print ans q = map(int, input().split()) map(int, input().split()) q idx_t=bisect_right(t,x[i]) bisect_right(t,x[i]) idx_t x=[int(input()) for _ in range(q)] [int(input()) for _ in range(q)] x d2=abs(ss-x[i])+abs(ss-tt),abs(tt-x[i])+abs(tt-ss) abs(tt-x[i])+abs(tt-ss) d2 inf=10**18 10**18 inf ans=min(ans,d1,d2) min(ans,d1,d2) ans a,b,q = map(int, input().split()) map(int, input().split()) a b,q = map(int, input().split()) map(int, input().split()) b s=[-inf]+[int(input()) for _ in range(a)]+[inf] [-inf]+[int(input()) for _ in range(a)]+[inf] s idx_s=bisect_right(s,x[i]) bisect_right(s,x[i]) idx_s ans=inf inf ans d1,d2=abs(ss-x[i])+abs(ss-tt),abs(tt-x[i])+abs(tt-ss) abs(ss-x[i])+abs(ss-tt) d1 t=[-inf]+[int(input()) for _ in range(b)]+[inf] [-inf]+[int(input()) for _ in range(b)]+[inf] t
a,b,q = map(int, input().split())
inf=10**18
s=[-inf]+[int(input()) for _ in range(a)]+[inf]
t=[-inf]+[int(input()) for _ in range(b)]+[inf]
x=[int(input()) for _ in range(q)]
from bisect import bisect_left,bisect_right
for i in range(q):
    idx_s=bisect_right(s,x[i])
    idx_t=bisect_right(t,x[i])
    ans=inf
    for ss in [s[idx_s-1],s[idx_s]]:
        for tt in [t[idx_t-1],t[idx_t]]:
            d1,d2=abs(ss-x[i])+abs(ss-tt),abs(tt-x[i])+abs(tt-ss)
            ans=min(ans,d1,d2)
    print(ans)