import bisect

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

INF=10**18
S=[-INF]+[int(input()) for i in range(A)]+[INF]
T=[-INF]+[int(input()) for i in range(B)]+[INF]

for i in range(Q):
    x = int(input())
    s = bisect.bisect_left(S, x)
    t = bisect.bisect_left(T, x)
    saisyo = float("inf")
    for j in [S[s], S[s-1]]:
        for k in [T[t], T[t-1]]:
            saisyo = min(saisyo, abs(j-x)+abs(k-j), abs(k-x)+abs(j-k))
    print(saisyo) import bisect bisect 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 i in range(A) for i in range(A) i range(A) range A for i in range(A) int(input()) int input() input S=[-INF]+[int(input()) for i in range(A)]+[INF] S [-INF]+[int(input()) for i in range(A)]+[INF] [-INF]+[int(input()) for i in range(A)] [-INF] -INF INF [int(input()) for i in range(A)] [INF] INF int(input()) for i in range(B) for i in range(B) i range(B) range B for i in range(B) int(input()) int input() input T=[-INF]+[int(input()) for i in range(B)]+[INF] T [-INF]+[int(input()) for i in range(B)]+[INF] [-INF]+[int(input()) for i in range(B)] [-INF] -INF INF [int(input()) for i in range(B)] [INF] INF for i in range(Q):
    x = int(input())
    s = bisect.bisect_left(S, x)
    t = bisect.bisect_left(T, x)
    saisyo = float("inf")
    for j in [S[s], S[s-1]]:
        for k in [T[t], T[t-1]]:
            saisyo = min(saisyo, abs(j-x)+abs(k-j), abs(k-x)+abs(j-k))
    print(saisyo) i range(Q) range Q x = int(input()) x int(input()) int input() input s = bisect.bisect_left(S, x) s bisect.bisect_left(S, x) bisect.bisect_left bisect bisect_left S x t = bisect.bisect_left(T, x) t bisect.bisect_left(T, x) bisect.bisect_left bisect bisect_left T x saisyo = float("inf") saisyo float("inf") float "inf" for j in [S[s], S[s-1]]:
        for k in [T[t], T[t-1]]:
            saisyo = min(saisyo, abs(j-x)+abs(k-j), abs(k-x)+abs(j-k))
     j [S[s], S[s-1]] S[s] S s S[s-1] S s-1 s 1 for k in [T[t], T[t-1]]:
            saisyo = min(saisyo, abs(j-x)+abs(k-j), abs(k-x)+abs(j-k))
     k [T[t], T[t-1]] T[t] T t T[t-1] T t-1 t 1 saisyo = min(saisyo, abs(j-x)+abs(k-j), abs(k-x)+abs(j-k)) saisyo min(saisyo, abs(j-x)+abs(k-j), abs(k-x)+abs(j-k)) min saisyo abs(j-x)+abs(k-j) abs(j-x) abs j-x j x abs(k-j) abs k-j k j abs(k-x)+abs(j-k) abs(k-x) abs k-x k x abs(j-k) abs j-k j k print(saisyo) print saisyo saisyo = min(saisyo, abs(j-x)+abs(k-j), abs(k-x)+abs(j-k)) min(saisyo, abs(j-x)+abs(k-j), abs(k-x)+abs(j-k)) saisyo Q = map(int, input().split()) map(int, input().split()) Q s = bisect.bisect_left(S, x) bisect.bisect_left(S, x) s B, Q = map(int, input().split()) map(int, input().split()) B saisyo = float("inf") float("inf") saisyo S=[-INF]+[int(input()) for i in range(A)]+[INF] [-INF]+[int(input()) for i in range(A)]+[INF] S t = bisect.bisect_left(T, x) bisect.bisect_left(T, x) t INF=10**18 10**18 INF A, B, Q = map(int, input().split()) map(int, input().split()) A x = int(input()) int(input()) x T=[-INF]+[int(input()) for i in range(B)]+[INF] [-INF]+[int(input()) for i in range(B)]+[INF] T
import bisect

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

INF=10**18
S=[-INF]+[int(input()) for i in range(A)]+[INF]
T=[-INF]+[int(input()) for i in range(B)]+[INF]

for i in range(Q):
    x = int(input())
    s = bisect.bisect_left(S, x)
    t = bisect.bisect_left(T, x)
    saisyo = float("inf")
    for j in [S[s], S[s-1]]:
        for k in [T[t], T[t-1]]:
            saisyo = min(saisyo, abs(j-x)+abs(k-j), abs(k-x)+abs(j-k))
    print(saisyo)