import bisect
A,B,Q=map(int,input().split())
s=[-10**15]
t=[-10**15]
ans=[]
for _ in range(A):
    s.append(int(input()))
for _ in range(B):
    t.append(int(input()))
s.append(10**15)
t.append(10**15)
def search(a,b,q):
    dis=10**15
    S=[s[a-1],s[a]]
    T=[t[b-1],t[b]]
    for i in range(2):
        for j in range(2):
            A=min(abs(S[i]-q),abs(T[j]-q))+abs(S[i]-T[j])
            dis=min(dis,A)
    return dis
for _ in range(Q):
    q=int(input())
    r=bisect.bisect_left(s,q)
    l=bisect.bisect_left(t,q)
    ans.append(search(r,l,q))
for i in ans:
    print(i) 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=[-10**15] s [-10**15] -10**15 -10 15 t=[-10**15] t [-10**15] -10**15 -10 15 ans=[] ans [] for _ in range(A):
    s.append(int(input())) _ range(A) range A s.append(int(input())) s.append s append int(input()) int input() input for _ in range(B):
    t.append(int(input())) _ range(B) range B t.append(int(input())) t.append t append int(input()) int input() input s.append(10**15) s.append s append 10**15 10 15 t.append(10**15) t.append t append 10**15 10 15 def search(a,b,q):
    dis=10**15
    S=[s[a-1],s[a]]
    T=[t[b-1],t[b]]
    for i in range(2):
        for j in range(2):
            A=min(abs(S[i]-q),abs(T[j]-q))+abs(S[i]-T[j])
            dis=min(dis,A)
    return dis search dis=10**15 dis 10**15 10 15 S=[s[a-1],s[a]] S [s[a-1],s[a]] s[a-1] s a-1 a 1 s[a] s a T=[t[b-1],t[b]] T [t[b-1],t[b]] t[b-1] t b-1 b 1 t[b] t b for i in range(2):
        for j in range(2):
            A=min(abs(S[i]-q),abs(T[j]-q))+abs(S[i]-T[j])
            dis=min(dis,A)
     i range(2) range 2 for j in range(2):
            A=min(abs(S[i]-q),abs(T[j]-q))+abs(S[i]-T[j])
            dis=min(dis,A)
     j range(2) range 2 A=min(abs(S[i]-q),abs(T[j]-q))+abs(S[i]-T[j]) A min(abs(S[i]-q),abs(T[j]-q))+abs(S[i]-T[j]) min(abs(S[i]-q),abs(T[j]-q)) min abs(S[i]-q) abs S[i]-q S[i] S i q abs(T[j]-q) abs T[j]-q T[j] T j q abs(S[i]-T[j]) abs S[i]-T[j] S[i] S i T[j] T j dis=min(dis,A) dis min(dis,A) min dis A return dis dis a a b b q q for _ in range(Q):
    q=int(input())
    r=bisect.bisect_left(s,q)
    l=bisect.bisect_left(t,q)
    ans.append(search(r,l,q)) _ range(Q) range Q q=int(input()) q int(input()) int input() input r=bisect.bisect_left(s,q) r bisect.bisect_left(s,q) bisect.bisect_left bisect bisect_left s q l=bisect.bisect_left(t,q) l bisect.bisect_left(t,q) bisect.bisect_left bisect bisect_left t q ans.append(search(r,l,q)) ans.append ans append search(r,l,q) search r l q for i in ans:
    print(i) i ans print(i) print i q=int(input()) int(input()) q ans=[] [] ans t=[-10**15] [-10**15] t def search(a,b,q):
    dis=10**15
    S=[s[a-1],s[a]]
    T=[t[b-1],t[b]]
    for i in range(2):
        for j in range(2):
            A=min(abs(S[i]-q),abs(T[j]-q))+abs(S[i]-T[j])
            dis=min(dis,A)
    return dis def search(a,b,q):
    dis=10**15
    S=[s[a-1],s[a]]
    T=[t[b-1],t[b]]
    for i in range(2):
        for j in range(2):
            A=min(abs(S[i]-q),abs(T[j]-q))+abs(S[i]-T[j])
            dis=min(dis,A)
    return dis search B,Q=map(int,input().split()) map(int,input().split()) B s=[-10**15] [-10**15] s A,B,Q=map(int,input().split()) map(int,input().split()) A r=bisect.bisect_left(s,q) bisect.bisect_left(s,q) r l=bisect.bisect_left(t,q) bisect.bisect_left(t,q) l Q=map(int,input().split()) map(int,input().split()) Q
import bisect
A,B,Q=map(int,input().split())
s=[-10**15]
t=[-10**15]
ans=[]
for _ in range(A):
    s.append(int(input()))
for _ in range(B):
    t.append(int(input()))
s.append(10**15)
t.append(10**15)
def search(a,b,q):
    dis=10**15
    S=[s[a-1],s[a]]
    T=[t[b-1],t[b]]
    for i in range(2):
        for j in range(2):
            A=min(abs(S[i]-q),abs(T[j]-q))+abs(S[i]-T[j])
            dis=min(dis,A)
    return dis
for _ in range(Q):
    q=int(input())
    r=bisect.bisect_left(s,q)
    l=bisect.bisect_left(t,q)
    ans.append(search(r,l,q))
for i in ans:
    print(i)