from bisect import bisect_right
A, B, Q = map(int, input().split())
INF = float('inf')
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)]
for x in X:
    b, d =  bisect_right(S, x), bisect_right(T, x)
    ans = INF
    for s in [S[b - 1], S[b]]:
        for t in [T[d - 1], T[d]]:
            d1, d2 = abs(s - x) + abs(s - t), abs(t - x) + abs(s - t)
            ans = min(ans, d1, d2)
    print(ans) from bisect import bisect_right 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 = [-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)] for x in X:
    b, d =  bisect_right(S, x), bisect_right(T, x)
    ans = INF
    for s in [S[b - 1], S[b]]:
        for t in [T[d - 1], T[d]]:
            d1, d2 = abs(s - x) + abs(s - t), abs(t - x) + abs(s - t)
            ans = min(ans, d1, d2)
    print(ans) x X b, d =  bisect_right(S, x), bisect_right(T, x) b bisect_right(S, x) bisect_right S x d bisect_right(T, x) bisect_right T x ans = INF ans INF for s in [S[b - 1], S[b]]:
        for t in [T[d - 1], T[d]]:
            d1, d2 = abs(s - x) + abs(s - t), abs(t - x) + abs(s - t)
            ans = min(ans, d1, d2)
     s [S[b - 1], S[b]] S[b - 1] S b - 1 b 1 S[b] S b for t in [T[d - 1], T[d]]:
            d1, d2 = abs(s - x) + abs(s - t), abs(t - x) + abs(s - t)
            ans = min(ans, d1, d2)
     t [T[d - 1], T[d]] T[d - 1] T d - 1 d 1 T[d] T d d1, d2 = abs(s - x) + abs(s - t), abs(t - x) + abs(s - t) d1 abs(s - x) + abs(s - t) abs(s - x) abs s - x s x abs(s - t) abs s - t s t 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 INF = float('inf') float('inf') INF d2 = abs(s - x) + abs(s - t), abs(t - x) + abs(s - t) abs(t - x) + abs(s - t) d2 Q = map(int, input().split()) map(int, input().split()) Q X = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] X d1, d2 = abs(s - x) + abs(s - t), abs(t - x) + abs(s - t) abs(s - x) + abs(s - t) d1 ans = min(ans, d1, d2) min(ans, d1, d2) ans d =  bisect_right(S, x), bisect_right(T, x) bisect_right(T, x) d A, B, Q = map(int, input().split()) map(int, input().split()) A ans = INF INF ans T = [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] + [INF] T b, d =  bisect_right(S, x), bisect_right(T, x) bisect_right(S, x) b S = [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] + [INF] S B, Q = map(int, input().split()) map(int, input().split()) B
from bisect import bisect_right
A, B, Q = map(int, input().split())
INF = float('inf')
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)]
for x in X:
    b, d =  bisect_right(S, x), bisect_right(T, x)
    ans = INF
    for s in [S[b - 1], S[b]]:
        for t in [T[d - 1], T[d]]:
            d1, d2 = abs(s - x) + abs(s - t), abs(t - x) + abs(s - t)
            ans = min(ans, d1, d2)
    print(ans)