from bisect import bisect_left
A, B, Q = map(int,input().split())
INF = 2 * 10 ** 10
S = [-INF]
T = [-INF]
for _ in range(A):
    S.append(int(input()))
S.append(INF)
for _ in range(B):
    T.append(int(input()))
T.append(INF)
for _ in range(Q):
    x = int(input())
    s = bisect_left(S, x)
    t = bisect_left(T, x)
    ans = min(max(S[s], T[t]) - x, x - min(S[s-1], T[t-1]), 2 * S[s] - T[t-1] - x, 2 * T[t] - S[s-1] - x, T[t] + x - 2 * S[s-1], S[s] + x - 2 * T[t-1])
    print(ans) 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 = 2 * 10 ** 10 INF 2 * 10 ** 10 2 10 ** 10 10 10 S = [-INF] S [-INF] -INF INF T = [-INF] T [-INF] -INF INF for _ in range(A):
    S.append(int(input())) _ range(A) range A S.append(int(input())) S.append S append int(input()) int input() input S.append(INF) S.append S append INF for _ in range(B):
    T.append(int(input())) _ range(B) range B T.append(int(input())) T.append T append int(input()) int input() input T.append(INF) T.append T append INF for _ in range(Q):
    x = int(input())
    s = bisect_left(S, x)
    t = bisect_left(T, x)
    ans = min(max(S[s], T[t]) - x, x - min(S[s-1], T[t-1]), 2 * S[s] - T[t-1] - x, 2 * T[t] - S[s-1] - x, T[t] + x - 2 * S[s-1], S[s] + x - 2 * T[t-1])
    print(ans) _ range(Q) range Q x = int(input()) x int(input()) int input() input s = bisect_left(S, x) s bisect_left(S, x) bisect_left S x t = bisect_left(T, x) t bisect_left(T, x) bisect_left T x ans = min(max(S[s], T[t]) - x, x - min(S[s-1], T[t-1]), 2 * S[s] - T[t-1] - x, 2 * T[t] - S[s-1] - x, T[t] + x - 2 * S[s-1], S[s] + x - 2 * T[t-1]) ans min(max(S[s], T[t]) - x, x - min(S[s-1], T[t-1]), 2 * S[s] - T[t-1] - x, 2 * T[t] - S[s-1] - x, T[t] + x - 2 * S[s-1], S[s] + x - 2 * T[t-1]) min max(S[s], T[t]) - x max(S[s], T[t]) max S[s] S s T[t] T t x x - min(S[s-1], T[t-1]) x min(S[s-1], T[t-1]) min S[s-1] S s-1 s 1 T[t-1] T t-1 t 1 2 * S[s] - T[t-1] - x 2 * S[s] - T[t-1] 2 * S[s] 2 S[s] S s T[t-1] T t-1 t 1 x 2 * T[t] - S[s-1] - x 2 * T[t] - S[s-1] 2 * T[t] 2 T[t] T t S[s-1] S s-1 s 1 x T[t] + x - 2 * S[s-1] T[t] + x T[t] T t x 2 * S[s-1] 2 S[s-1] S s-1 s 1 S[s] + x - 2 * T[t-1] S[s] + x S[s] S s x 2 * T[t-1] 2 T[t-1] T t-1 t 1 print(ans) print ans s = bisect_left(S, x) bisect_left(S, x) s B, Q = map(int,input().split()) map(int,input().split()) B S = [-INF] [-INF] S x = int(input()) int(input()) x A, B, Q = map(int,input().split()) map(int,input().split()) A INF = 2 * 10 ** 10 2 * 10 ** 10 INF Q = map(int,input().split()) map(int,input().split()) Q T = [-INF] [-INF] T t = bisect_left(T, x) bisect_left(T, x) t ans = min(max(S[s], T[t]) - x, x - min(S[s-1], T[t-1]), 2 * S[s] - T[t-1] - x, 2 * T[t] - S[s-1] - x, T[t] + x - 2 * S[s-1], S[s] + x - 2 * T[t-1]) min(max(S[s], T[t]) - x, x - min(S[s-1], T[t-1]), 2 * S[s] - T[t-1] - x, 2 * T[t] - S[s-1] - x, T[t] + x - 2 * S[s-1], S[s] + x - 2 * T[t-1]) ans
from bisect import bisect_left
A, B, Q = map(int,input().split())
INF = 2 * 10 ** 10
S = [-INF]
T = [-INF]
for _ in range(A):
    S.append(int(input()))
S.append(INF)
for _ in range(B):
    T.append(int(input()))
T.append(INF)
for _ in range(Q):
    x = int(input())
    s = bisect_left(S, x)
    t = bisect_left(T, x)
    ans = min(max(S[s], T[t]) - x, x - min(S[s-1], T[t-1]), 2 * S[s] - T[t-1] - x, 2 * T[t] - S[s-1] - x, T[t] + x - 2 * S[s-1], S[s] + x - 2 * T[t-1])
    print(ans)