A,B,Q = map(int,input().split())
INF = 10**18
S = [-INF] + [int(input()) for _ in range(A)] + [INF]

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

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

from bisect import bisect_left

for _ in range(Q):
    ans = INF
    x = X[_]
    idxs = bisect_left(S, x)
    idxt = bisect_left(T, x)
    for s in [S[idxs-1], S[idxs]]:
        for t in [T[idxt-1], T[idxt]]:
            d1, d2 = abs(s-x) + abs(t-s), abs(t-x) + abs(s-t)
            ans = min(ans, d1, d2)
    print(ans)
 A,B,Q = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q INF = 10**18 INF 10**18 10 18 int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input S = [-INF] + [int(input()) for _ in range(A)] + [INF] S [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] [-INF] -INF INF [int(input()) for _ in range(A)] [INF] INF int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input T = [-INF] + [int(input()) for _ in range(B)] + [INF] T [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] [-INF] -INF INF [int(input()) for _ in range(B)] [INF] INF int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input X = [int(input()) for _ in range(Q)] X [int(input()) for _ in range(Q)] from bisect import bisect_left for _ in range(Q):
    ans = INF
    x = X[_]
    idxs = bisect_left(S, x)
    idxt = bisect_left(T, x)
    for s in [S[idxs-1], S[idxs]]:
        for t in [T[idxt-1], T[idxt]]:
            d1, d2 = abs(s-x) + abs(t-s), abs(t-x) + abs(s-t)
            ans = min(ans, d1, d2)
    print(ans) _ range(Q) range Q ans = INF ans INF x = X[_] x X[_] X _ idxs = bisect_left(S, x) idxs bisect_left(S, x) bisect_left S x idxt = bisect_left(T, x) idxt bisect_left(T, x) bisect_left T x for s in [S[idxs-1], S[idxs]]:
        for t in [T[idxt-1], T[idxt]]:
            d1, d2 = abs(s-x) + abs(t-s), abs(t-x) + abs(s-t)
            ans = min(ans, d1, d2)
     s [S[idxs-1], S[idxs]] S[idxs-1] S idxs-1 idxs 1 S[idxs] S idxs for t in [T[idxt-1], T[idxt]]:
            d1, d2 = abs(s-x) + abs(t-s), abs(t-x) + abs(s-t)
            ans = min(ans, d1, d2)
     t [T[idxt-1], T[idxt]] T[idxt-1] T idxt-1 idxt 1 T[idxt] T idxt d1, d2 = abs(s-x) + abs(t-s), abs(t-x) + abs(s-t) d1 abs(s-x) + abs(t-s) abs(s-x) abs s-x s x abs(t-s) abs t-s t s d2 abs(t-x) + abs(s-t) abs(t-x) abs t-x t x abs(s-t) abs s-t s t ans = min(ans, d1, d2) ans min(ans, d1, d2) min ans d1 d2 print(ans) print ans d2 = abs(s-x) + abs(t-s), abs(t-x) + abs(s-t) abs(t-x) + abs(s-t) d2 A,B,Q = map(int,input().split()) map(int,input().split()) A T = [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] + [INF] T x = X[_] X[_] x idxs = bisect_left(S, x) bisect_left(S, x) idxs B,Q = map(int,input().split()) map(int,input().split()) B idxt = bisect_left(T, x) bisect_left(T, x) idxt d1, d2 = abs(s-x) + abs(t-s), abs(t-x) + abs(s-t) abs(s-x) + abs(t-s) d1 S = [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] + [INF] S Q = map(int,input().split()) map(int,input().split()) Q ans = INF INF ans INF = 10**18 10**18 INF X = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] X ans = min(ans, d1, d2) min(ans, d1, d2) ans
A,B,Q = map(int,input().split())
INF = 10**18
S = [-INF] + [int(input()) for _ in range(A)] + [INF]

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

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

from bisect import bisect_left

for _ in range(Q):
    ans = INF
    x = X[_]
    idxs = bisect_left(S, x)
    idxt = bisect_left(T, x)
    for s in [S[idxs-1], S[idxs]]:
        for t in [T[idxt-1], T[idxt]]:
            d1, d2 = abs(s-x) + abs(t-s), abs(t-x) + abs(s-t)
            ans = min(ans, d1, d2)
    print(ans)

