import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

for x in X:
    SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20
    i = bisect.bisect_left(S, x)
    if i != 0:
        SL = x-S[i-1]
    if i != A:
        SR = S[i]-x

    j = bisect.bisect_left(T, x)
    if j != 0:
        TL = x-T[j-1]
    if j != B:
        TR = T[j]-x

    ans = min(max(SL, TL), min(2*SL+TR, SL+2*TR),
              min(2*TL+SR, TL+2*SR), max(SR, TR))
    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 int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input S = [int(input()) for _ in range(A)] S [int(input()) for _ in range(A)] int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input T = [int(input()) for _ in range(B)] T [int(input()) for _ in range(B)] 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:
    SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20
    i = bisect.bisect_left(S, x)
    if i != 0:
        SL = x-S[i-1]
    if i != A:
        SR = S[i]-x

    j = bisect.bisect_left(T, x)
    if j != 0:
        TL = x-T[j-1]
    if j != B:
        TR = T[j]-x

    ans = min(max(SL, TL), min(2*SL+TR, SL+2*TR),
              min(2*TL+SR, TL+2*SR), max(SR, TR))
    print(ans) x X SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20 SL 10**20 10 20 SR 10**20 10 20 TL 10**20 10 20 TR 10**20 10 20 i = bisect.bisect_left(S, x) i bisect.bisect_left(S, x) bisect.bisect_left bisect bisect_left S x if i != 0:
        SL = x-S[i-1]
     i != 0 i 0 SL = x-S[i-1] SL x-S[i-1] x S[i-1] S i-1 i 1 if i != A:
        SR = S[i]-x

     i != A i A SR = S[i]-x SR S[i]-x S[i] S i x j = bisect.bisect_left(T, x) j bisect.bisect_left(T, x) bisect.bisect_left bisect bisect_left T x if j != 0:
        TL = x-T[j-1]
     j != 0 j 0 TL = x-T[j-1] TL x-T[j-1] x T[j-1] T j-1 j 1 if j != B:
        TR = T[j]-x

     j != B j B TR = T[j]-x TR T[j]-x T[j] T j x ans = min(max(SL, TL), min(2*SL+TR, SL+2*TR),
              min(2*TL+SR, TL+2*SR), max(SR, TR)) ans min(max(SL, TL), min(2*SL+TR, SL+2*TR),
              min(2*TL+SR, TL+2*SR), max(SR, TR)) min max(SL, TL) max SL TL min(2*SL+TR, SL+2*TR) min 2*SL+TR 2*SL 2 SL TR SL+2*TR SL 2*TR 2 TR min(2*TL+SR, TL+2*SR) min 2*TL+SR 2*TL 2 TL SR TL+2*SR TL 2*SR 2 SR max(SR, TR) max SR TR print(ans) print ans ans = min(max(SL, TL), min(2*SL+TR, SL+2*TR),
              min(2*TL+SR, TL+2*SR), max(SR, TR)) min(max(SL, TL), min(2*SL+TR, SL+2*TR),
              min(2*TL+SR, TL+2*SR), max(SR, TR)) ans j = bisect.bisect_left(T, x) bisect.bisect_left(T, x) j TR = T[j]-x T[j]-x TR TL = x-T[j-1] x-T[j-1] TL S = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] S SR, TL, TR = 10**20, 10**20, 10**20, 10**20 10**20 SR B, Q = map(int, input().split()) map(int, input().split()) B TR = 10**20, 10**20, 10**20, 10**20 10**20 TR TL, TR = 10**20, 10**20, 10**20, 10**20 10**20 TL SR = S[i]-x S[i]-x SR A, B, Q = map(int, input().split()) map(int, input().split()) A SL = x-S[i-1] x-S[i-1] SL i = bisect.bisect_left(S, x) bisect.bisect_left(S, x) i T = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] T Q = map(int, input().split()) map(int, input().split()) Q X = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] X SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20 10**20 SL
import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

for x in X:
    SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20
    i = bisect.bisect_left(S, x)
    if i != 0:
        SL = x-S[i-1]
    if i != A:
        SR = S[i]-x

    j = bisect.bisect_left(T, x)
    if j != 0:
        TL = x-T[j-1]
    if j != B:
        TR = T[j]-x

    ans = min(max(SL, TL), min(2*SL+TR, SL+2*TR),
              min(2*TL+SR, TL+2*SR), max(SR, TR))
    print(ans)
