import bisect

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

s=[int(eval(input()))for _ in range(a)]

s.append(12345678901234)

s.insert(0,-12345678901234)

t=[int(eval(input()))for _ in range(b)]

t.append(12345678901234)

t.insert(0,-12345678901234)

for query in range(q):

    ans = 123456789012345

    x=int(eval(input()))

    idxs = bisect.bisect_left(s,x)

    idxt = bisect.bisect_left(t,x)

    ls = s[idxs-1]

    rs=s[idxs]

    lt=t[idxt-1]

    rt=t[idxt]

    # 左

    ans = min(ans,max(abs(x-ls),abs(x-lt)))



    # 右

    ans = min(ans,max(abs(x-rs),abs(x-rt)))    



    # 行って帰って

    ans = min(ans,2*abs(x-ls)+abs(x-rt))

    ans = min(ans,2*abs(x-lt)+abs(x-rs))

    ans = min(ans,2*abs(x-rs)+abs(x-lt))

    ans = min(ans,2*abs(x-rt)+abs(x-ls))

    

    print(ans)

import bisect

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

INF = 12345678901234

s=[int(eval(input()))for _ in range(a)]

s.append(INF)

s.insert(0,-INF)

t=[int(eval(input()))for _ in range(b)]

t.append(INF)

t.insert(0,-INF)

for query in range(q):

    ans = INF

    x=int(eval(input()))

    idxs = bisect.bisect_left(s,x)

    idxt = bisect.bisect_left(t,x)

    ls = x - s[idxs-1]

    rs = s[idxs] - x

    lt = x - t[idxt-1]

    rt = t[idxt] - x

    

    ans = min( ans, max(ls,lt) )

    ans = min( ans, max(rt,rs) )    

    ans = min( ans, ls + rt + min(ls,rt) )

    ans = min( ans, lt + rs + min(lt,rs) )

    

    print(ans)
import bisect

a, b, q = list(map(int, input().split()))
s = [int(eval(input())) for _ in range(a)]
s.append(12345678901234)
s.insert(0, -12345678901234)
t = [int(eval(input())) for _ in range(b)]
t.append(12345678901234)
t.insert(0, -12345678901234)
for query in range(q):
    ans = 123456789012345
    x = int(eval(input()))
    idxs = bisect.bisect_left(s, x)
    idxt = bisect.bisect_left(t, x)
    ls = s[idxs - 1]
    rs = s[idxs]
    lt = t[idxt - 1]
    rt = t[idxt]
    # 左
    ans = min(ans, max(abs(x - ls), abs(x - lt)))
    # 右
    ans = min(ans, max(abs(x - rs), abs(x - rt)))
    # 行って帰って
    ans = min(ans, 2 * abs(x - ls) + abs(x - rt))
    ans = min(ans, 2 * abs(x - lt) + abs(x - rs))
    ans = min(ans, 2 * abs(x - rs) + abs(x - lt))
    ans = min(ans, 2 * abs(x - rt) + abs(x - ls))
    print(ans)

import bisect

a, b, q = list(map(int, input().split()))
INF = 12345678901234
s = [int(eval(input())) for _ in range(a)]
s.append(INF)
s.insert(0, -INF)
t = [int(eval(input())) for _ in range(b)]
t.append(INF)
t.insert(0, -INF)
for query in range(q):
    ans = INF
    x = int(eval(input()))
    idxs = bisect.bisect_left(s, x)
    idxt = bisect.bisect_left(t, x)
    ls = x - s[idxs - 1]
    rs = s[idxs] - x
    lt = x - t[idxt - 1]
    rt = t[idxt] - x
    ans = min(ans, max(ls, lt))
    ans = min(ans, max(rt, rs))
    ans = min(ans, ls + rt + min(ls, rt))
    ans = min(ans, lt + rs + min(lt, rs))
    print(ans)

+INF = 12345678901234 -s.append(12345678901234) -s.insert(0, -12345678901234) +s.append(INF) +s.insert(0, -INF) -t.append(12345678901234) -t.insert(0, -12345678901234) +t.append(INF) +t.insert(0, -INF) -    ans = 123456789012345 +    ans = INF -    ls = s[idxs - 1] -    rs = s[idxs] -    lt = t[idxt - 1] -    rt = t[idxt] -    # 左 -    ans = min(ans, max(abs(x - ls), abs(x - lt))) -    # 右 -    ans = min(ans, max(abs(x - rs), abs(x - rt))) -    # 行って帰って -    ans = min(ans, 2 * abs(x - ls) + abs(x - rt)) -    ans = min(ans, 2 * abs(x - lt) + abs(x - rs)) -    ans = min(ans, 2 * abs(x - rs) + abs(x - lt)) -    ans = min(ans, 2 * abs(x - rt) + abs(x - ls)) +    ls = x - s[idxs - 1] +    rs = s[idxs] - x +    lt = x - t[idxt - 1] +    rt = t[idxt] - x +    ans = min(ans, max(ls, lt)) +    ans = min(ans, max(rt, rs)) +    ans = min(ans, ls + rt + min(ls, rt)) +    ans = min(ans, lt + rs + min(lt, rs))