import sys
input=sys.stdin.readline
a, b, q = map(int, input().split())
s = []
t = []
x = []
for i in range(a):
    s.append(int(input()))
for i in range(b):
    t.append(int(input()))
for i in range(q):
    x.append(int(input()))
import bisect
def get(x):
    ls,rs,lt,rt=10**13,10**13,10**13,10**13
    s_ind = bisect.bisect_left(s,x)
    t_ind = bisect.bisect_left(t,x)
    if s_ind!=0:
        ls=abs(x - s[s_ind-1])
    if s_ind!=a:
        rs=abs(x - s[s_ind])
    if t_ind!=0:
        lt=abs(x - t[t_ind-1])
    if t_ind!=b:
        rt=abs(x - t[t_ind])
    return ls,rs,lt,rt

for que in x:
    ls,rs,lt,rt = get(que)

    rr = max(rs,rt)
    ll = max(ls,lt)
    lsrt = 2*ls+rt
    ltrs = 2*lt+rs
    rslt = 2*rs+lt
    rtls = 2*rt+ls
    ans = min([rr,ll,lsrt,ltrs,rslt,rtls])
    print(ans) import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 [] x = [] x [] for i in range(a):
    s.append(int(input())) i range(a) range a s.append(int(input())) s.append s append int(input()) int input() input for i in range(b):
    t.append(int(input())) i range(b) range b t.append(int(input())) t.append t append int(input()) int input() input for i in range(q):
    x.append(int(input())) i range(q) range q x.append(int(input())) x.append x append int(input()) int input() input import bisect bisect def get(x):
    ls,rs,lt,rt=10**13,10**13,10**13,10**13
    s_ind = bisect.bisect_left(s,x)
    t_ind = bisect.bisect_left(t,x)
    if s_ind!=0:
        ls=abs(x - s[s_ind-1])
    if s_ind!=a:
        rs=abs(x - s[s_ind])
    if t_ind!=0:
        lt=abs(x - t[t_ind-1])
    if t_ind!=b:
        rt=abs(x - t[t_ind])
    return ls,rs,lt,rt get ls,rs,lt,rt=10**13,10**13,10**13,10**13 ls 10**13 10 13 rs 10**13 10 13 lt 10**13 10 13 rt 10**13 10 13 s_ind = bisect.bisect_left(s,x) s_ind bisect.bisect_left(s,x) bisect.bisect_left bisect bisect_left s x t_ind = bisect.bisect_left(t,x) t_ind bisect.bisect_left(t,x) bisect.bisect_left bisect bisect_left t x if s_ind!=0:
        ls=abs(x - s[s_ind-1])
     s_ind!=0 s_ind 0 ls=abs(x - s[s_ind-1]) ls abs(x - s[s_ind-1]) abs x - s[s_ind-1] x s[s_ind-1] s s_ind-1 s_ind 1 if s_ind!=a:
        rs=abs(x - s[s_ind])
     s_ind!=a s_ind a rs=abs(x - s[s_ind]) rs abs(x - s[s_ind]) abs x - s[s_ind] x s[s_ind] s s_ind if t_ind!=0:
        lt=abs(x - t[t_ind-1])
     t_ind!=0 t_ind 0 lt=abs(x - t[t_ind-1]) lt abs(x - t[t_ind-1]) abs x - t[t_ind-1] x t[t_ind-1] t t_ind-1 t_ind 1 if t_ind!=b:
        rt=abs(x - t[t_ind])
     t_ind!=b t_ind b rt=abs(x - t[t_ind]) rt abs(x - t[t_ind]) abs x - t[t_ind] x t[t_ind] t t_ind return ls,rs,lt,rt return ls,rs,lt,rt ls rs lt rt x x for que in x:
    ls,rs,lt,rt = get(que)

    rr = max(rs,rt)
    ll = max(ls,lt)
    lsrt = 2*ls+rt
    ltrs = 2*lt+rs
    rslt = 2*rs+lt
    rtls = 2*rt+ls
    ans = min([rr,ll,lsrt,ltrs,rslt,rtls])
    print(ans) que x ls,rs,lt,rt = get(que) ls get(que) get que rs lt rt rr = max(rs,rt) rr max(rs,rt) max rs rt ll = max(ls,lt) ll max(ls,lt) max ls lt lsrt = 2*ls+rt lsrt 2*ls+rt 2*ls 2 ls rt ltrs = 2*lt+rs ltrs 2*lt+rs 2*lt 2 lt rs rslt = 2*rs+lt rslt 2*rs+lt 2*rs 2 rs lt rtls = 2*rt+ls rtls 2*rt+ls 2*rt 2 rt ls ans = min([rr,ll,lsrt,ltrs,rslt,rtls]) ans min([rr,ll,lsrt,ltrs,rslt,rtls]) min [rr,ll,lsrt,ltrs,rslt,rtls] rr ll lsrt ltrs rslt rtls print(ans) print ans lsrt = 2*ls+rt 2*ls+rt lsrt rtls = 2*rt+ls 2*rt+ls rtls t = [] [] t ll = max(ls,lt) max(ls,lt) ll x = [] [] x rslt = 2*rs+lt 2*rs+lt rslt ltrs = 2*lt+rs 2*lt+rs ltrs s = [] [] s a, b, q = map(int, input().split()) map(int, input().split()) a rs,lt,rt = get(que) get(que) rs b, q = map(int, input().split()) map(int, input().split()) b ans = min([rr,ll,lsrt,ltrs,rslt,rtls]) min([rr,ll,lsrt,ltrs,rslt,rtls]) ans rt = get(que) get(que) rt def get(x):
    ls,rs,lt,rt=10**13,10**13,10**13,10**13
    s_ind = bisect.bisect_left(s,x)
    t_ind = bisect.bisect_left(t,x)
    if s_ind!=0:
        ls=abs(x - s[s_ind-1])
    if s_ind!=a:
        rs=abs(x - s[s_ind])
    if t_ind!=0:
        lt=abs(x - t[t_ind-1])
    if t_ind!=b:
        rt=abs(x - t[t_ind])
    return ls,rs,lt,rt def get(x):
    ls,rs,lt,rt=10**13,10**13,10**13,10**13
    s_ind = bisect.bisect_left(s,x)
    t_ind = bisect.bisect_left(t,x)
    if s_ind!=0:
        ls=abs(x - s[s_ind-1])
    if s_ind!=a:
        rs=abs(x - s[s_ind])
    if t_ind!=0:
        lt=abs(x - t[t_ind-1])
    if t_ind!=b:
        rt=abs(x - t[t_ind])
    return ls,rs,lt,rt get rr = max(rs,rt) max(rs,rt) rr ls,rs,lt,rt = get(que) get(que) ls input=sys.stdin.readline sys.stdin.readline input q = map(int, input().split()) map(int, input().split()) q lt,rt = get(que) get(que) lt
import sys
input=sys.stdin.readline
a, b, q = map(int, input().split())
s = []
t = []
x = []
for i in range(a):
    s.append(int(input()))
for i in range(b):
    t.append(int(input()))
for i in range(q):
    x.append(int(input()))
import bisect
def get(x):
    ls,rs,lt,rt=10**13,10**13,10**13,10**13
    s_ind = bisect.bisect_left(s,x)
    t_ind = bisect.bisect_left(t,x)
    if s_ind!=0:
        ls=abs(x - s[s_ind-1])
    if s_ind!=a:
        rs=abs(x - s[s_ind])
    if t_ind!=0:
        lt=abs(x - t[t_ind-1])
    if t_ind!=b:
        rt=abs(x - t[t_ind])
    return ls,rs,lt,rt

for que in x:
    ls,rs,lt,rt = get(que)

    rr = max(rs,rt)
    ll = max(ls,lt)
    lsrt = 2*ls+rt
    ltrs = 2*lt+rs
    rslt = 2*rs+lt
    rtls = 2*rt+ls
    ans = min([rr,ll,lsrt,ltrs,rslt,rtls])
    print(ans)