import bisect
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]

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

for q in range(Q):
    x = int(input())
    b,d = bisect.bisect_right(s,x), bisect.bisect_right(t,x)
    res = INF
    for S in [s[b-1], s[b]]:
        for T in [t[d-1], t[d]]:
            d1, d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
            res = min(res, d1,d2)
    print(res)
    
