from bisect import bisect_left

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

inf = float('inf')

S = [-inf] + [int(eval(input())) for i in range(A)] + [inf]

T = [-inf] + [int(eval(input())) for i in range(B)] + [inf]

X = [int(eval(input())) for i in range(Q)]

for x in X:

    si = bisect_left(S,x); ti = bisect_left(T,x)

    ans = inf

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

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

            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.readline



from bisect import bisect



inf = float('inf')



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

S = [-inf] + [int(eval(input())) for _ in range(A)] + [inf]

T = [-inf] + [int(eval(input())) for _ in range(B)] + [inf]

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



for x in X:

    ans = inf

    si = bisect(S,x)

    ti = bisect(T,x)

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

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

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

            ans = min(ans,res)

    print(ans)
from bisect import bisect_left

A, B, Q = list(map(int, input().split()))
inf = float("inf")
S = [-inf] + [int(eval(input())) for i in range(A)] + [inf]
T = [-inf] + [int(eval(input())) for i in range(B)] + [inf]
X = [int(eval(input())) for i in range(Q)]
for x in X:
    si = bisect_left(S, x)
    ti = bisect_left(T, x)
    ans = inf
    for s in [S[si - 1], S[si]]:
        for t in [T[ti - 1], T[ti]]:
            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.readline
from bisect import bisect

inf = float("inf")
A, B, Q = list(map(int, input().split()))
S = [-inf] + [int(eval(input())) for _ in range(A)] + [inf]
T = [-inf] + [int(eval(input())) for _ in range(B)] + [inf]
X = [int(eval(input())) for _ in range(Q)]
for x in X:
    ans = inf
    si = bisect(S, x)
    ti = bisect(T, x)
    for s in [S[si - 1], S[si]]:
        for t in [T[ti - 1], T[ti]]:
            res = abs(s - t) + min(abs(x - s), abs(x - t))
            ans = min(ans, res)
    print(ans)

-from bisect import bisect_left +import sys +input = sys.stdin.readline +from bisect import bisect + +inf = float("inf") -inf = float("inf") -S = [-inf] + [int(eval(input())) for i in range(A)] + [inf] -T = [-inf] + [int(eval(input())) for i in range(B)] + [inf] -X = [int(eval(input())) for i in range(Q)] +S = [-inf] + [int(eval(input())) for _ in range(A)] + [inf] +T = [-inf] + [int(eval(input())) for _ in range(B)] + [inf] +X = [int(eval(input())) for _ in range(Q)] -    si = bisect_left(S, x) -    ti = bisect_left(T, x) +    si = bisect(S, x) +    ti = bisect(T, x) -            d1 = abs(s - x) + abs(t - s) -            d2 = abs(t - x) + abs(s - t) -            ans = min(ans, d1, d2) +            res = abs(s - t) + min(abs(x - s), abs(x - t)) +            ans = min(ans, res)