from bisect import bisect_left


A,B,Q = map(int, input().split())
INF = float("inf")
S = [int(input()) for _ in range(A)]
S = [-INF] + S + [INF]
T = [int(input()) for _ in range(B)]
T = [-INF] + T + [INF]
X = [int(input()) for _ in range(Q)]

ans = []
for x in X:
    idx_s = bisect_left(S, x)
    idx_t = bisect_left(T, x)
    candidate = [max(abs(x - T[idx_t - 1]), abs(x - S[idx_s-1])),
                max(abs(x - S[idx_s]), abs(x - T[idx_t])),
                2*abs(x - S[idx_s-1]) + abs(x - T[idx_t]),
                2*abs(x - T[idx_t]) + abs(x - S[idx_s-1]),
                2*abs(x - T[idx_t-1]) + abs(x - S[idx_s]),
                2*abs(x - S[idx_s]) + abs(x - T[idx_t-1])
                ]
    ans.append(min(candidate))

print(*ans, sep="\n") from bisect import bisect_left A,B,Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q INF = float("inf") INF float("inf") float "inf" int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input S = [int(input()) for _ in range(A)] S [int(input()) for _ in range(A)] S = [-INF] + S + [INF] S [-INF] + S + [INF] [-INF] + S [-INF] -INF INF S [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 = [int(input()) for _ in range(B)] T [int(input()) for _ in range(B)] T = [-INF] + T + [INF] T [-INF] + T + [INF] [-INF] + T [-INF] -INF INF T [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)] ans = [] ans [] for x in X:
    idx_s = bisect_left(S, x)
    idx_t = bisect_left(T, x)
    candidate = [max(abs(x - T[idx_t - 1]), abs(x - S[idx_s-1])),
                max(abs(x - S[idx_s]), abs(x - T[idx_t])),
                2*abs(x - S[idx_s-1]) + abs(x - T[idx_t]),
                2*abs(x - T[idx_t]) + abs(x - S[idx_s-1]),
                2*abs(x - T[idx_t-1]) + abs(x - S[idx_s]),
                2*abs(x - S[idx_s]) + abs(x - T[idx_t-1])
                ]
    ans.append(min(candidate)) x X idx_s = bisect_left(S, x) idx_s bisect_left(S, x) bisect_left S x idx_t = bisect_left(T, x) idx_t bisect_left(T, x) bisect_left T x candidate = [max(abs(x - T[idx_t - 1]), abs(x - S[idx_s-1])),
                max(abs(x - S[idx_s]), abs(x - T[idx_t])),
                2*abs(x - S[idx_s-1]) + abs(x - T[idx_t]),
                2*abs(x - T[idx_t]) + abs(x - S[idx_s-1]),
                2*abs(x - T[idx_t-1]) + abs(x - S[idx_s]),
                2*abs(x - S[idx_s]) + abs(x - T[idx_t-1])
                ] candidate [max(abs(x - T[idx_t - 1]), abs(x - S[idx_s-1])),
                max(abs(x - S[idx_s]), abs(x - T[idx_t])),
                2*abs(x - S[idx_s-1]) + abs(x - T[idx_t]),
                2*abs(x - T[idx_t]) + abs(x - S[idx_s-1]),
                2*abs(x - T[idx_t-1]) + abs(x - S[idx_s]),
                2*abs(x - S[idx_s]) + abs(x - T[idx_t-1])
                ] max(abs(x - T[idx_t - 1]), abs(x - S[idx_s-1])) max abs(x - T[idx_t - 1]) abs x - T[idx_t - 1] x T[idx_t - 1] T idx_t - 1 idx_t 1 abs(x - S[idx_s-1]) abs x - S[idx_s-1] x S[idx_s-1] S idx_s-1 idx_s 1 max(abs(x - S[idx_s]), abs(x - T[idx_t])) max abs(x - S[idx_s]) abs x - S[idx_s] x S[idx_s] S idx_s abs(x - T[idx_t]) abs x - T[idx_t] x T[idx_t] T idx_t 2*abs(x - S[idx_s-1]) + abs(x - T[idx_t]) 2*abs(x - S[idx_s-1]) 2 abs(x - S[idx_s-1]) abs x - S[idx_s-1] x S[idx_s-1] S idx_s-1 idx_s 1 abs(x - T[idx_t]) abs x - T[idx_t] x T[idx_t] T idx_t 2*abs(x - T[idx_t]) + abs(x - S[idx_s-1]) 2*abs(x - T[idx_t]) 2 abs(x - T[idx_t]) abs x - T[idx_t] x T[idx_t] T idx_t abs(x - S[idx_s-1]) abs x - S[idx_s-1] x S[idx_s-1] S idx_s-1 idx_s 1 2*abs(x - T[idx_t-1]) + abs(x - S[idx_s]) 2*abs(x - T[idx_t-1]) 2 abs(x - T[idx_t-1]) abs x - T[idx_t-1] x T[idx_t-1] T idx_t-1 idx_t 1 abs(x - S[idx_s]) abs x - S[idx_s] x S[idx_s] S idx_s 2*abs(x - S[idx_s]) + abs(x - T[idx_t-1]) 2*abs(x - S[idx_s]) 2 abs(x - S[idx_s]) abs x - S[idx_s] x S[idx_s] S idx_s abs(x - T[idx_t-1]) abs x - T[idx_t-1] x T[idx_t-1] T idx_t-1 idx_t 1 ans.append(min(candidate)) ans.append ans append min(candidate) min candidate print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" ans = [] [] ans idx_t = bisect_left(T, x) bisect_left(T, x) idx_t Q = map(int, input().split()) map(int, input().split()) Q X = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] X idx_s = bisect_left(S, x) bisect_left(S, x) idx_s T = [-INF] + T + [INF] [-INF] + T + [INF] T A,B,Q = map(int, input().split()) map(int, input().split()) A S = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] S S = [-INF] + S + [INF] [-INF] + S + [INF] S T = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] T INF = float("inf") float("inf") INF B,Q = map(int, input().split()) map(int, input().split()) B candidate = [max(abs(x - T[idx_t - 1]), abs(x - S[idx_s-1])),
                max(abs(x - S[idx_s]), abs(x - T[idx_t])),
                2*abs(x - S[idx_s-1]) + abs(x - T[idx_t]),
                2*abs(x - T[idx_t]) + abs(x - S[idx_s-1]),
                2*abs(x - T[idx_t-1]) + abs(x - S[idx_s]),
                2*abs(x - S[idx_s]) + abs(x - T[idx_t-1])
                ] [max(abs(x - T[idx_t - 1]), abs(x - S[idx_s-1])),
                max(abs(x - S[idx_s]), abs(x - T[idx_t])),
                2*abs(x - S[idx_s-1]) + abs(x - T[idx_t]),
                2*abs(x - T[idx_t]) + abs(x - S[idx_s-1]),
                2*abs(x - T[idx_t-1]) + abs(x - S[idx_s]),
                2*abs(x - S[idx_s]) + abs(x - T[idx_t-1])
                ] candidate
from bisect import bisect_left


A,B,Q = map(int, input().split())
INF = float("inf")
S = [int(input()) for _ in range(A)]
S = [-INF] + S + [INF]
T = [int(input()) for _ in range(B)]
T = [-INF] + T + [INF]
X = [int(input()) for _ in range(Q)]

ans = []
for x in X:
    idx_s = bisect_left(S, x)
    idx_t = bisect_left(T, x)
    candidate = [max(abs(x - T[idx_t - 1]), abs(x - S[idx_s-1])),
                max(abs(x - S[idx_s]), abs(x - T[idx_t])),
                2*abs(x - S[idx_s-1]) + abs(x - T[idx_t]),
                2*abs(x - T[idx_t]) + abs(x - S[idx_s-1]),
                2*abs(x - T[idx_t-1]) + abs(x - S[idx_s]),
                2*abs(x - S[idx_s]) + abs(x - T[idx_t-1])
                ]
    ans.append(min(candidate))

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