a,b,q=map(int,input().split())

s=[int(input()) for _ in range(a)]
t=[int(input()) for _ in range(b)]
x=[int(input()) for _ in range(q)]

s.sort()
t.sort()

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
for item in x:
    ss=bisect.bisect_left(s, item)
    tmp=[]
    if ss>0:
        tmp.append(s[ss-1])
    if ss<len(s):
        tmp.append(s[ss])
    tmp2=[]
    tt=bisect.bisect_left(t, item)
    if tt>0:
        tmp2.append(t[tt-1])
    if tt<len(t):
        tmp2.append(t[tt])
    #print(item,tmp2,tmp)
    result=10**18
    for item2 in tmp:
        for item3 in tmp2:
            #print(item,item2,item3)
            result=min(result,abs(item-item3)+abs(item3-item2),abs(item-item2)+abs(item3-item2))
    print(result)


 a,b,q=map(int,input().split()) a 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=[int(input()) for _ in range(a)] s [int(input()) for _ in range(a)] int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t=[int(input()) for _ in range(b)] t [int(input()) for _ in range(b)] 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)] s.sort() s.sort s sort t.sort() t.sort t sort import bisect bisect for item in x:
    ss=bisect.bisect_left(s, item)
    tmp=[]
    if ss>0:
        tmp.append(s[ss-1])
    if ss<len(s):
        tmp.append(s[ss])
    tmp2=[]
    tt=bisect.bisect_left(t, item)
    if tt>0:
        tmp2.append(t[tt-1])
    if tt<len(t):
        tmp2.append(t[tt])
    #print(item,tmp2,tmp)
    result=10**18
    for item2 in tmp:
        for item3 in tmp2:
            #print(item,item2,item3)
            result=min(result,abs(item-item3)+abs(item3-item2),abs(item-item2)+abs(item3-item2))
    print(result) item x ss=bisect.bisect_left(s, item) ss bisect.bisect_left(s, item) bisect.bisect_left bisect bisect_left s item tmp=[] tmp [] if ss>0:
        tmp.append(s[ss-1])
     ss>0 ss 0 tmp.append(s[ss-1]) tmp.append tmp append s[ss-1] s ss-1 ss 1 if ss<len(s):
        tmp.append(s[ss])
     ss<len(s) ss len(s) len s tmp.append(s[ss]) tmp.append tmp append s[ss] s ss tmp2=[] tmp2 [] tt=bisect.bisect_left(t, item) tt bisect.bisect_left(t, item) bisect.bisect_left bisect bisect_left t item if tt>0:
        tmp2.append(t[tt-1])
     tt>0 tt 0 tmp2.append(t[tt-1]) tmp2.append tmp2 append t[tt-1] t tt-1 tt 1 if tt<len(t):
        tmp2.append(t[tt])
    #print(item,tmp2,tmp)
     tt<len(t) tt len(t) len t tmp2.append(t[tt]) tmp2.append tmp2 append t[tt] t tt result=10**18 result 10**18 10 18 for item2 in tmp:
        for item3 in tmp2:
            #print(item,item2,item3)
            result=min(result,abs(item-item3)+abs(item3-item2),abs(item-item2)+abs(item3-item2))
     item2 tmp for item3 in tmp2:
            #print(item,item2,item3)
            result=min(result,abs(item-item3)+abs(item3-item2),abs(item-item2)+abs(item3-item2))
     item3 tmp2 result=min(result,abs(item-item3)+abs(item3-item2),abs(item-item2)+abs(item3-item2)) result min(result,abs(item-item3)+abs(item3-item2),abs(item-item2)+abs(item3-item2)) min result abs(item-item3)+abs(item3-item2) abs(item-item3) abs item-item3 item item3 abs(item3-item2) abs item3-item2 item3 item2 abs(item-item2)+abs(item3-item2) abs(item-item2) abs item-item2 item item2 abs(item3-item2) abs item3-item2 item3 item2 print(result) print result result=10**18 10**18 result tt=bisect.bisect_left(t, item) bisect.bisect_left(t, item) tt t=[int(input()) for _ in range(b)] [int(input()) for _ in range(b)] t tmp2=[] [] tmp2 a,b,q=map(int,input().split()) map(int,input().split()) a s=[int(input()) for _ in range(a)] [int(input()) for _ in range(a)] s tmp=[] [] tmp result=min(result,abs(item-item3)+abs(item3-item2),abs(item-item2)+abs(item3-item2)) min(result,abs(item-item3)+abs(item3-item2),abs(item-item2)+abs(item3-item2)) result b,q=map(int,input().split()) map(int,input().split()) b q=map(int,input().split()) map(int,input().split()) q x=[int(input()) for _ in range(q)] [int(input()) for _ in range(q)] x ss=bisect.bisect_left(s, item) bisect.bisect_left(s, item) ss
a,b,q=map(int,input().split())

s=[int(input()) for _ in range(a)]
t=[int(input()) for _ in range(b)]
x=[int(input()) for _ in range(q)]

s.sort()
t.sort()

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
for item in x:
    ss=bisect.bisect_left(s, item)
    tmp=[]
    if ss>0:
        tmp.append(s[ss-1])
    if ss<len(s):
        tmp.append(s[ss])
    tmp2=[]
    tt=bisect.bisect_left(t, item)
    if tt>0:
        tmp2.append(t[tt-1])
    if tt<len(t):
        tmp2.append(t[tt])
    #print(item,tmp2,tmp)
    result=10**18
    for item2 in tmp:
        for item3 in tmp2:
            #print(item,item2,item3)
            result=min(result,abs(item-item3)+abs(item3-item2),abs(item-item2)+abs(item3-item2))
    print(result)



