from bisect import bisect_left,bisect

icase=0
if icase==0:
    a,b,q=map(int,input().split())
    s=[0]*a
    for i in range(a):
        s[i]=int(input())
    t=[0]*b
    for i in range(b):
        t[i]=int(input())
    x=[0]*q
    for i in range(q):
        x[i]=int(input())
elif icase==1:
    a,b,q=2,3,4
    s=[100, 600]
    t=[400, 900, 1000]
    x=[150,2000,899,799]

si=[0]*a
j=-1
for i in range(a):
    si[i]=b-1
    while j+2<b:
        j+=1
        if abs(s[i]-t[j])<abs(s[i]-t[j+1]):
            si[i]=j
            j-=1
            break

ti=[0]*b
j=-1
for i in range(b):
    ti[i]=a-1
    while j+2<a:
        j+=1
        if abs(t[i]-s[j])<abs(t[i]-s[j+1]):
            ti[i]=j
            j-=1
            break
    
for k in range(q):
    sk=max(min(bisect(s,x[k])-1,a-1),0)
    tk=max(min(bisect(t,x[k])-1,b-1),0)
#    print(sk,tk)
    r1=abs(x[k]-s[sk])+abs(s[sk]-t[si[sk]])
    if sk+1<a:
        r2=abs(x[k]-s[sk+1])+abs(s[sk+1]-t[si[sk+1]])
    else:
        r2=r1
    r3=abs(x[k]-t[tk])+abs(t[tk]-s[ti[tk]])
    if tk+1<b:
        r4=abs(x[k]-t[tk+1])+abs(t[tk+1]-s[ti[tk+1]])
    else:
        r4=r3
#    print(min((r1,r2,r3,r4)),r1,r2,r3,r4)
    print(min((r1,r2,r3,r4))) from bisect import bisect_left,bisect icase=0 icase 0 if icase==0:
    a,b,q=map(int,input().split())
    s=[0]*a
    for i in range(a):
        s[i]=int(input())
    t=[0]*b
    for i in range(b):
        t[i]=int(input())
    x=[0]*q
    for i in range(q):
        x[i]=int(input())
elif icase==1:
    a,b,q=2,3,4
    s=[100, 600]
    t=[400, 900, 1000]
    x=[150,2000,899,799] icase==0 icase 0 a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q s=[0]*a s [0]*a [0] 0 a for i in range(a):
        s[i]=int(input())
     i range(a) range a s[i]=int(input()) s[i] s i int(input()) int input() input t=[0]*b t [0]*b [0] 0 b for i in range(b):
        t[i]=int(input())
     i range(b) range b t[i]=int(input()) t[i] t i int(input()) int input() input x=[0]*q x [0]*q [0] 0 q for i in range(q):
        x[i]=int(input()) i range(q) range q x[i]=int(input()) x[i] x i int(input()) int input() input elif icase==1:
    a,b,q=2,3,4
    s=[100, 600]
    t=[400, 900, 1000]
    x=[150,2000,899,799] icase==1 icase 1 a,b,q=2,3,4 a 2 b 3 q 4 s=[100, 600] s [100, 600] 100 600 t=[400, 900, 1000] t [400, 900, 1000] 400 900 1000 x=[150,2000,899,799] x [150,2000,899,799] 150 2000 899 799 si=[0]*a si [0]*a [0] 0 a j=-1 j -1 for i in range(a):
    si[i]=b-1
    while j+2<b:
        j+=1
        if abs(s[i]-t[j])<abs(s[i]-t[j+1]):
            si[i]=j
            j-=1
            break i range(a) range a si[i]=b-1 si[i] si i b-1 b 1 while j+2<b:
        j+=1
        if abs(s[i]-t[j])<abs(s[i]-t[j+1]):
            si[i]=j
            j-=1
            break j+2<b j+2 j 2 b j+=1 j 1 if abs(s[i]-t[j])<abs(s[i]-t[j+1]):
            si[i]=j
            j-=1
            break abs(s[i]-t[j])<abs(s[i]-t[j+1]) abs(s[i]-t[j]) abs s[i]-t[j] s[i] s i t[j] t j abs(s[i]-t[j+1]) abs s[i]-t[j+1] s[i] s i t[j+1] t j+1 j 1 si[i]=j si[i] si i j j-=1 j 1 break ti=[0]*b ti [0]*b [0] 0 b j=-1 j -1 for i in range(b):
    ti[i]=a-1
    while j+2<a:
        j+=1
        if abs(t[i]-s[j])<abs(t[i]-s[j+1]):
            ti[i]=j
            j-=1
            break
     i range(b) range b ti[i]=a-1 ti[i] ti i a-1 a 1 while j+2<a:
        j+=1
        if abs(t[i]-s[j])<abs(t[i]-s[j+1]):
            ti[i]=j
            j-=1
            break
     j+2<a j+2 j 2 a j+=1 j 1 if abs(t[i]-s[j])<abs(t[i]-s[j+1]):
            ti[i]=j
            j-=1
            break
     abs(t[i]-s[j])<abs(t[i]-s[j+1]) abs(t[i]-s[j]) abs t[i]-s[j] t[i] t i s[j] s j abs(t[i]-s[j+1]) abs t[i]-s[j+1] t[i] t i s[j+1] s j+1 j 1 ti[i]=j ti[i] ti i j j-=1 j 1 break for k in range(q):
    sk=max(min(bisect(s,x[k])-1,a-1),0)
    tk=max(min(bisect(t,x[k])-1,b-1),0)
#    print(sk,tk)
    r1=abs(x[k]-s[sk])+abs(s[sk]-t[si[sk]])
    if sk+1<a:
        r2=abs(x[k]-s[sk+1])+abs(s[sk+1]-t[si[sk+1]])
    else:
        r2=r1
    r3=abs(x[k]-t[tk])+abs(t[tk]-s[ti[tk]])
    if tk+1<b:
        r4=abs(x[k]-t[tk+1])+abs(t[tk+1]-s[ti[tk+1]])
    else:
        r4=r3
#    print(min((r1,r2,r3,r4)),r1,r2,r3,r4)
    print(min((r1,r2,r3,r4))) k range(q) range q sk=max(min(bisect(s,x[k])-1,a-1),0) sk max(min(bisect(s,x[k])-1,a-1),0) max min(bisect(s,x[k])-1,a-1) min bisect(s,x[k])-1 bisect(s,x[k]) bisect s x[k] x k 1 a-1 a 1 0 tk=max(min(bisect(t,x[k])-1,b-1),0) tk max(min(bisect(t,x[k])-1,b-1),0) max min(bisect(t,x[k])-1,b-1) min bisect(t,x[k])-1 bisect(t,x[k]) bisect t x[k] x k 1 b-1 b 1 0 r1=abs(x[k]-s[sk])+abs(s[sk]-t[si[sk]]) r1 abs(x[k]-s[sk])+abs(s[sk]-t[si[sk]]) abs(x[k]-s[sk]) abs x[k]-s[sk] x[k] x k s[sk] s sk abs(s[sk]-t[si[sk]]) abs s[sk]-t[si[sk]] s[sk] s sk t[si[sk]] t si[sk] si sk if sk+1<a:
        r2=abs(x[k]-s[sk+1])+abs(s[sk+1]-t[si[sk+1]])
    else:
        r2=r1
     sk+1<a sk+1 sk 1 a r2=abs(x[k]-s[sk+1])+abs(s[sk+1]-t[si[sk+1]]) r2 abs(x[k]-s[sk+1])+abs(s[sk+1]-t[si[sk+1]]) abs(x[k]-s[sk+1]) abs x[k]-s[sk+1] x[k] x k s[sk+1] s sk+1 sk 1 abs(s[sk+1]-t[si[sk+1]]) abs s[sk+1]-t[si[sk+1]] s[sk+1] s sk+1 sk 1 t[si[sk+1]] t si[sk+1] si sk+1 sk 1 r2=r1 r2 r1 r3=abs(x[k]-t[tk])+abs(t[tk]-s[ti[tk]]) r3 abs(x[k]-t[tk])+abs(t[tk]-s[ti[tk]]) abs(x[k]-t[tk]) abs x[k]-t[tk] x[k] x k t[tk] t tk abs(t[tk]-s[ti[tk]]) abs t[tk]-s[ti[tk]] t[tk] t tk s[ti[tk]] s ti[tk] ti tk if tk+1<b:
        r4=abs(x[k]-t[tk+1])+abs(t[tk+1]-s[ti[tk+1]])
    else:
        r4=r3
#    print(min((r1,r2,r3,r4)),r1,r2,r3,r4)
     tk+1<b tk+1 tk 1 b r4=abs(x[k]-t[tk+1])+abs(t[tk+1]-s[ti[tk+1]]) r4 abs(x[k]-t[tk+1])+abs(t[tk+1]-s[ti[tk+1]]) abs(x[k]-t[tk+1]) abs x[k]-t[tk+1] x[k] x k t[tk+1] t tk+1 tk 1 abs(t[tk+1]-s[ti[tk+1]]) abs t[tk+1]-s[ti[tk+1]] t[tk+1] t tk+1 tk 1 s[ti[tk+1]] s ti[tk+1] ti tk+1 tk 1 r4=r3 r4 r3 print(min((r1,r2,r3,r4))) print min((r1,r2,r3,r4)) min (r1,r2,r3,r4) r1 r2 r3 r4 j=-1 -1 j r2=r1 r1 r2 r4=abs(x[k]-t[tk+1])+abs(t[tk+1]-s[ti[tk+1]]) abs(x[k]-t[tk+1])+abs(t[tk+1]-s[ti[tk+1]]) r4 x=[150,2000,899,799] [150,2000,899,799] x x=[0]*q [0]*q x icase=0 0 icase t=[0]*b [0]*b t r3=abs(x[k]-t[tk])+abs(t[tk]-s[ti[tk]]) abs(x[k]-t[tk])+abs(t[tk]-s[ti[tk]]) r3 ti=[0]*b [0]*b ti r2=abs(x[k]-s[sk+1])+abs(s[sk+1]-t[si[sk+1]]) abs(x[k]-s[sk+1])+abs(s[sk+1]-t[si[sk+1]]) r2 r1=abs(x[k]-s[sk])+abs(s[sk]-t[si[sk]]) abs(x[k]-s[sk])+abs(s[sk]-t[si[sk]]) r1 a,b,q=map(int,input().split()) map(int,input().split()) a q=2,3,4 4 q si=[0]*a [0]*a si j+=1 1 j a,b,q=2,3,4 2 a r4=r3 r3 r4 s=[100, 600] [100, 600] s b,q=map(int,input().split()) map(int,input().split()) b j+=1 1 j q=map(int,input().split()) map(int,input().split()) q s=[0]*a [0]*a s b,q=2,3,4 3 b j-=1 1 j sk=max(min(bisect(s,x[k])-1,a-1),0) max(min(bisect(s,x[k])-1,a-1),0) sk j=-1 -1 j t=[400, 900, 1000] [400, 900, 1000] t j-=1 1 j tk=max(min(bisect(t,x[k])-1,b-1),0) max(min(bisect(t,x[k])-1,b-1),0) tk
from bisect import bisect_left,bisect

icase=0
if icase==0:
    a,b,q=map(int,input().split())
    s=[0]*a
    for i in range(a):
        s[i]=int(input())
    t=[0]*b
    for i in range(b):
        t[i]=int(input())
    x=[0]*q
    for i in range(q):
        x[i]=int(input())
elif icase==1:
    a,b,q=2,3,4
    s=[100, 600]
    t=[400, 900, 1000]
    x=[150,2000,899,799]

si=[0]*a
j=-1
for i in range(a):
    si[i]=b-1
    while j+2<b:
        j+=1
        if abs(s[i]-t[j])<abs(s[i]-t[j+1]):
            si[i]=j
            j-=1
            break

ti=[0]*b
j=-1
for i in range(b):
    ti[i]=a-1
    while j+2<a:
        j+=1
        if abs(t[i]-s[j])<abs(t[i]-s[j+1]):
            ti[i]=j
            j-=1
            break
    
for k in range(q):
    sk=max(min(bisect(s,x[k])-1,a-1),0)
    tk=max(min(bisect(t,x[k])-1,b-1),0)
#    print(sk,tk)
    r1=abs(x[k]-s[sk])+abs(s[sk]-t[si[sk]])
    if sk+1<a:
        r2=abs(x[k]-s[sk+1])+abs(s[sk+1]-t[si[sk+1]])
    else:
        r2=r1
    r3=abs(x[k]-t[tk])+abs(t[tk]-s[ti[tk]])
    if tk+1<b:
        r4=abs(x[k]-t[tk+1])+abs(t[tk+1]-s[ti[tk+1]])
    else:
        r4=r3
#    print(min((r1,r2,r3,r4)),r1,r2,r3,r4)
    print(min((r1,r2,r3,r4)))
