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