import bisect



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

tem=[-10**18]+[int(input()) for _ in range(a)]+[10**18]

shr=[-10**18]+[int(input()) for _ in range(b)]+[10**18]

ans=[]



for _ in range(q):

    x=int(input())

    t=bisect.bisect_right(tem, x)

    s=bisect.bisect_right(shr, x)

    dt=[tem[t-1], tem[t]]

    ds=[shr[s-1], shr[s]]



    res=10**18

    for i in dt:

        for j in ds:

            d1=abs(x-i)+abs(i-j)

            d2=abs(x-j)+abs(i-j)

            res=min(res, d1, d2)

    ans.append(res)



print(*ans, sep="\n")

    



import sys

import bisect

input = sys.stdin.readline



A, B, Q = map(int, input().split())

tera = [int(input()) for _ in range(A)]

sha = [int(input()) for _ in range(B)]

query = [int(input()) for _ in range(Q)]

res = []



for x in query:

    tl = bisect.bisect_left(tera, x)

    tr = bisect.bisect_right(tera, x)

    sl = bisect.bisect_left(sha, x)

    sr = bisect.bisect_right(sha, x)



    if tl == 0:

        temple = [tera[0]]

    elif tr == A:

        temple = [tera[A - 1]]

    else:

        temple = [tera[tl-1], tera[tl]]



    if sl == 0:

        shrine = [sha[0]]

    elif sr == B:

        shrine = [sha[B - 1]]

    else:

        shrine = [sha[sl-1], sha[sl]]



    ans = 10**18

    for t in temple:

        for s in shrine:

            tx = t - x

            sx = s - x

            if tx * sx >= 0:

                a = max(abs(tx), abs(sx))

            else:

                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx))

            ans = min(ans, a)

    res.append(ans)



print(*res, sep="\n")

import bisect

a, b, q = map(int, input().split())
tem = [-(10**18)] + [int(input()) for _ in range(a)] + [10**18]
shr = [-(10**18)] + [int(input()) for _ in range(b)] + [10**18]
ans = []
for _ in range(q):
    x = int(input())
    t = bisect.bisect_right(tem, x)
    s = bisect.bisect_right(shr, x)
    dt = [tem[t - 1], tem[t]]
    ds = [shr[s - 1], shr[s]]
    res = 10**18
    for i in dt:
        for j in ds:
            d1 = abs(x - i) + abs(i - j)
            d2 = abs(x - j) + abs(i - j)
            res = min(res, d1, d2)
    ans.append(res)
print(*ans, sep="\n")

import sys
import bisect

input = sys.stdin.readline
A, B, Q = map(int, input().split())
tera = [int(input()) for _ in range(A)]
sha = [int(input()) for _ in range(B)]
query = [int(input()) for _ in range(Q)]
res = []
for x in query:
    tl = bisect.bisect_left(tera, x)
    tr = bisect.bisect_right(tera, x)
    sl = bisect.bisect_left(sha, x)
    sr = bisect.bisect_right(sha, x)
    if tl == 0:
        temple = [tera[0]]
    elif tr == A:
        temple = [tera[A - 1]]
    else:
        temple = [tera[tl - 1], tera[tl]]
    if sl == 0:
        shrine = [sha[0]]
    elif sr == B:
        shrine = [sha[B - 1]]
    else:
        shrine = [sha[sl - 1], sha[sl]]
    ans = 10**18
    for t in temple:
        for s in shrine:
            tx = t - x
            sx = s - x
            if tx * sx >= 0:
                a = max(abs(tx), abs(sx))
            else:
                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx))
            ans = min(ans, a)
    res.append(ans)
print(*res, sep="\n")

+import sys -a, b, q = map(int, input().split()) -tem = [-(10**18)] + [int(input()) for _ in range(a)] + [10**18] -shr = [-(10**18)] + [int(input()) for _ in range(b)] + [10**18] -ans = [] -for _ in range(q): -    x = int(input()) -    t = bisect.bisect_right(tem, x) -    s = bisect.bisect_right(shr, x) -    dt = [tem[t - 1], tem[t]] -    ds = [shr[s - 1], shr[s]] -    res = 10**18 -    for i in dt: -        for j in ds: -            d1 = abs(x - i) + abs(i - j) -            d2 = abs(x - j) + abs(i - j) -            res = min(res, d1, d2) -    ans.append(res) -print(*ans, sep="\n") +input = sys.stdin.readline +A, B, Q = map(int, input().split()) +tera = [int(input()) for _ in range(A)] +sha = [int(input()) for _ in range(B)] +query = [int(input()) for _ in range(Q)] +res = [] +for x in query: +    tl = bisect.bisect_left(tera, x) +    tr = bisect.bisect_right(tera, x) +    sl = bisect.bisect_left(sha, x) +    sr = bisect.bisect_right(sha, x) +    if tl == 0: +        temple = [tera[0]] +    elif tr == A: +        temple = [tera[A - 1]] +    else: +        temple = [tera[tl - 1], tera[tl]] +    if sl == 0: +        shrine = [sha[0]] +    elif sr == B: +        shrine = [sha[B - 1]] +    else: +        shrine = [sha[sl - 1], sha[sl]] +    ans = 10**18 +    for t in temple: +        for s in shrine: +            tx = t - x +            sx = s - x +            if tx * sx >= 0: +                a = max(abs(tx), abs(sx)) +            else: +                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx)) +            ans = min(ans, a) +    res.append(ans) +print(*res, sep="\n")