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

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

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

S.sort()

T.sort()

INF = 10**18

S = [-INF] + S + [INF]

T = [-INF] + T + [INF]



import bisect

for _ in range(q):

    x = int(eval(input()))

    i = bisect.bisect_right(S, x)

    j = bisect.bisect_right(T, x)

    ans = INF

    for s in [S[i-1], S[i]]:

        for t in [T[j-1], T[j]]:

            d1 = abs(s-x) + abs(t-s)

            d2 = abs(t-x) + abs(s-t)

            ans = min([ans, d1, d2])

    print(ans)
import sys

input = sys.stdin.buffer.readline



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

S = [0]*a

T = [0]*b

for i in range(a):

    s = int(eval(input()))

    S[i] = s

for i in range(b):

    t = int(eval(input()))

    T[i] = t



S.sort()

T.sort()

S = [-10**18]+S+[10**18]

T = [-10**18]+T+[10**18]

import bisect

for i in range(q):

    x = int(eval(input()))

    ans = 10**18

    ids = bisect.bisect_right(S, x)

    idt = bisect.bisect_right(T, x)

    for ks in (-1, 0):

        for kt in (-1, 0):

            s = S[ids+ks]

            t = T[idt+kt]

            temp = min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t))

            ans = min(ans, temp)

    print(ans)
a, b, q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(a)]
T = [int(eval(input())) for _ in range(b)]
S.sort()
T.sort()
INF = 10**18
S = [-INF] + S + [INF]
T = [-INF] + T + [INF]
import bisect

for _ in range(q):
    x = int(eval(input()))
    i = bisect.bisect_right(S, x)
    j = bisect.bisect_right(T, x)
    ans = INF
    for s in [S[i - 1], S[i]]:
        for t in [T[j - 1], T[j]]:
            d1 = abs(s - x) + abs(t - s)
            d2 = abs(t - x) + abs(s - t)
            ans = min([ans, d1, d2])
    print(ans)

import sys

input = sys.stdin.buffer.readline
a, b, q = list(map(int, input().split()))
S = [0] * a
T = [0] * b
for i in range(a):
    s = int(eval(input()))
    S[i] = s
for i in range(b):
    t = int(eval(input()))
    T[i] = t
S.sort()
T.sort()
S = [-(10**18)] + S + [10**18]
T = [-(10**18)] + T + [10**18]
import bisect

for i in range(q):
    x = int(eval(input()))
    ans = 10**18
    ids = bisect.bisect_right(S, x)
    idt = bisect.bisect_right(T, x)
    for ks in (-1, 0):
        for kt in (-1, 0):
            s = S[ids + ks]
            t = T[idt + kt]
            temp = min(abs(s - x) + abs(s - t), abs(t - x) + abs(s - t))
            ans = min(ans, temp)
    print(ans)

+import sys + +input = sys.stdin.buffer.readline -S = [int(eval(input())) for _ in range(a)] -T = [int(eval(input())) for _ in range(b)] +S = [0] * a +T = [0] * b +for i in range(a): +    s = int(eval(input())) +    S[i] = s +for i in range(b): +    t = int(eval(input())) +    T[i] = t -INF = 10**18 -S = [-INF] + S + [INF] -T = [-INF] + T + [INF] +S = [-(10**18)] + S + [10**18] +T = [-(10**18)] + T + [10**18] -for _ in range(q): +for i in range(q): -    i = bisect.bisect_right(S, x) -    j = bisect.bisect_right(T, x) -    ans = INF -    for s in [S[i - 1], S[i]]: -        for t in [T[j - 1], T[j]]: -            d1 = abs(s - x) + abs(t - s) -            d2 = abs(t - x) + abs(s - t) -            ans = min([ans, d1, d2]) +    ans = 10**18 +    ids = bisect.bisect_right(S, x) +    idt = bisect.bisect_right(T, x) +    for ks in (-1, 0): +        for kt in (-1, 0): +            s = S[ids + ks] +            t = T[idt + kt] +            temp = min(abs(s - x) + abs(s - t), abs(t - x) + abs(s - t)) +            ans = min(ans, temp)