import bisect
a,b,q=map(int,input().split())
S=[];T=[]
for _ in range(a):
    s=int(input())
    S.append(s)
for _ in range(b):
    t=int(input())
    T.append(t)
S.append(10**12)
T.append(10**12)

for _ in range(q):
    x=int(input())
    idx_s=bisect.bisect_left(S,x)
    idx_t=bisect.bisect_left(T,x)
    se=S[idx_s]
    sw=S[idx_s-1]
    te=T[idx_t]
    tw=T[idx_t-1]

    ans=float("inf")
    for ss in [se,sw]:
        for tt in [te,tw]:
            ans=min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss))
    print(ans) import bisect bisect a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q S=[] S [] T=[] T [] for _ in range(a):
    s=int(input())
    S.append(s) _ range(a) range a s=int(input()) s int(input()) int input() input S.append(s) S.append S append s for _ in range(b):
    t=int(input())
    T.append(t) _ range(b) range b t=int(input()) t int(input()) int input() input T.append(t) T.append T append t S.append(10**12) S.append S append 10**12 10 12 T.append(10**12) T.append T append 10**12 10 12 for _ in range(q):
    x=int(input())
    idx_s=bisect.bisect_left(S,x)
    idx_t=bisect.bisect_left(T,x)
    se=S[idx_s]
    sw=S[idx_s-1]
    te=T[idx_t]
    tw=T[idx_t-1]

    ans=float("inf")
    for ss in [se,sw]:
        for tt in [te,tw]:
            ans=min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss))
    print(ans) _ range(q) range q x=int(input()) x int(input()) int input() input idx_s=bisect.bisect_left(S,x) idx_s bisect.bisect_left(S,x) bisect.bisect_left bisect bisect_left S x idx_t=bisect.bisect_left(T,x) idx_t bisect.bisect_left(T,x) bisect.bisect_left bisect bisect_left T x se=S[idx_s] se S[idx_s] S idx_s sw=S[idx_s-1] sw S[idx_s-1] S idx_s-1 idx_s 1 te=T[idx_t] te T[idx_t] T idx_t tw=T[idx_t-1] tw T[idx_t-1] T idx_t-1 idx_t 1 ans=float("inf") ans float("inf") float "inf" for ss in [se,sw]:
        for tt in [te,tw]:
            ans=min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss))
     ss [se,sw] se sw for tt in [te,tw]:
            ans=min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss))
     tt [te,tw] te tw ans=min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss)) ans min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss)) min ans abs(ss-x)+abs(tt-ss) abs(ss-x) abs ss-x ss x abs(tt-ss) abs tt-ss tt ss abs(tt-x)+abs(tt-ss) abs(tt-x) abs tt-x tt x abs(tt-ss) abs tt-ss tt ss print(ans) print ans s=int(input()) int(input()) s a,b,q=map(int,input().split()) map(int,input().split()) a tw=T[idx_t-1] T[idx_t-1] tw idx_t=bisect.bisect_left(T,x) bisect.bisect_left(T,x) idx_t S=[] [] S idx_s=bisect.bisect_left(S,x) bisect.bisect_left(S,x) idx_s ans=min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss)) min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss)) ans x=int(input()) int(input()) x se=S[idx_s] S[idx_s] se q=map(int,input().split()) map(int,input().split()) q te=T[idx_t] T[idx_t] te b,q=map(int,input().split()) map(int,input().split()) b sw=S[idx_s-1] S[idx_s-1] sw T=[] [] T ans=float("inf") float("inf") ans t=int(input()) int(input()) t
import bisect
a,b,q=map(int,input().split())
S=[];T=[]
for _ in range(a):
    s=int(input())
    S.append(s)
for _ in range(b):
    t=int(input())
    T.append(t)
S.append(10**12)
T.append(10**12)

for _ in range(q):
    x=int(input())
    idx_s=bisect.bisect_left(S,x)
    idx_t=bisect.bisect_left(T,x)
    se=S[idx_s]
    sw=S[idx_s-1]
    te=T[idx_t]
    tw=T[idx_t-1]

    ans=float("inf")
    for ss in [se,sw]:
        for tt in [te,tw]:
            ans=min(ans,abs(ss-x)+abs(tt-ss),abs(tt-x)+abs(tt-ss))
    print(ans)