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

def solver(S, A, x):
    d = []
    a = bisect.bisect_right(S, x)

    if a == A:
        d.append((-1, x - S[-1]))
    elif a == 0:
        d.append((1, S[0] - x))
    else:
        d.append((-1, x - S[a - 1]))
        d.append((1, S[a] - x))

    return d

for _ in range(Q):
    ans = 0
    x = int(sys.stdin.readline().rstrip())

    d_a = solver(S, A, x)
    d_b = solver(T, B, x)

    ans = 10**15
    for i, j in d_a:
        for k, l in d_b:
            if i == k:
                ans = min(ans, max(j, l))
            else:
                ans = min(ans, j + l + min(j, l))
    print(ans) import sys sys 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(sys.stdin.readline().rstrip()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(sys.stdin.readline().rstrip()) int sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip S = [int(sys.stdin.readline().rstrip()) for _ in range(A)] S [int(sys.stdin.readline().rstrip()) for _ in range(A)] int(sys.stdin.readline().rstrip()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(sys.stdin.readline().rstrip()) int sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip T = [int(sys.stdin.readline().rstrip()) for _ in range(B)] T [int(sys.stdin.readline().rstrip()) for _ in range(B)] def solver(S, A, x):
    d = []
    a = bisect.bisect_right(S, x)

    if a == A:
        d.append((-1, x - S[-1]))
    elif a == 0:
        d.append((1, S[0] - x))
    else:
        d.append((-1, x - S[a - 1]))
        d.append((1, S[a] - x))

    return d solver d = [] d [] a = bisect.bisect_right(S, x) a bisect.bisect_right(S, x) bisect.bisect_right bisect bisect_right S x if a == A:
        d.append((-1, x - S[-1]))
    elif a == 0:
        d.append((1, S[0] - x))
    else:
        d.append((-1, x - S[a - 1]))
        d.append((1, S[a] - x))

     a == A a A d.append((-1, x - S[-1])) d.append d append (-1, x - S[-1]) -1 x - S[-1] x S[-1] S -1 elif a == 0:
        d.append((1, S[0] - x))
     a == 0 a 0 d.append((1, S[0] - x)) d.append d append (1, S[0] - x) 1 S[0] - x S[0] S 0 x d.append((-1, x - S[a - 1])) d.append d append (-1, x - S[a - 1]) -1 x - S[a - 1] x S[a - 1] S a - 1 a 1 d.append((1, S[a] - x)) d.append d append (1, S[a] - x) 1 S[a] - x S[a] S a x return d d S S A A x x for _ in range(Q):
    ans = 0
    x = int(sys.stdin.readline().rstrip())

    d_a = solver(S, A, x)
    d_b = solver(T, B, x)

    ans = 10**15
    for i, j in d_a:
        for k, l in d_b:
            if i == k:
                ans = min(ans, max(j, l))
            else:
                ans = min(ans, j + l + min(j, l))
    print(ans) _ range(Q) range Q ans = 0 ans 0 x = int(sys.stdin.readline().rstrip()) x int(sys.stdin.readline().rstrip()) int sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip d_a = solver(S, A, x) d_a solver(S, A, x) solver S A x d_b = solver(T, B, x) d_b solver(T, B, x) solver T B x ans = 10**15 ans 10**15 10 15 for i, j in d_a:
        for k, l in d_b:
            if i == k:
                ans = min(ans, max(j, l))
            else:
                ans = min(ans, j + l + min(j, l))
     i j d_a for k, l in d_b:
            if i == k:
                ans = min(ans, max(j, l))
            else:
                ans = min(ans, j + l + min(j, l))
     k l d_b if i == k:
                ans = min(ans, max(j, l))
            else:
                ans = min(ans, j + l + min(j, l))
     i == k i k ans = min(ans, max(j, l)) ans min(ans, max(j, l)) min ans max(j, l) max j l ans = min(ans, j + l + min(j, l)) ans min(ans, j + l + min(j, l)) min ans j + l + min(j, l) j + l j l min(j, l) min j l print(ans) print ans T = [int(sys.stdin.readline().rstrip()) for _ in range(B)] [int(sys.stdin.readline().rstrip()) for _ in range(B)] T ans = min(ans, j + l + min(j, l)) min(ans, j + l + min(j, l)) ans ans = 10**15 10**15 ans B, Q = map(int, input().split()) map(int, input().split()) B ans = 0 0 ans d_a = solver(S, A, x) solver(S, A, x) d_a def solver(S, A, x):
    d = []
    a = bisect.bisect_right(S, x)

    if a == A:
        d.append((-1, x - S[-1]))
    elif a == 0:
        d.append((1, S[0] - x))
    else:
        d.append((-1, x - S[a - 1]))
        d.append((1, S[a] - x))

    return d def solver(S, A, x):
    d = []
    a = bisect.bisect_right(S, x)

    if a == A:
        d.append((-1, x - S[-1]))
    elif a == 0:
        d.append((1, S[0] - x))
    else:
        d.append((-1, x - S[a - 1]))
        d.append((1, S[a] - x))

    return d solver S = [int(sys.stdin.readline().rstrip()) for _ in range(A)] [int(sys.stdin.readline().rstrip()) for _ in range(A)] S Q = map(int, input().split()) map(int, input().split()) Q ans = min(ans, max(j, l)) min(ans, max(j, l)) ans d_b = solver(T, B, x) solver(T, B, x) d_b A, B, Q = map(int, input().split()) map(int, input().split()) A x = int(sys.stdin.readline().rstrip()) int(sys.stdin.readline().rstrip()) x
import sys
import bisect
A, B, Q = map(int, input().split())
S = [int(sys.stdin.readline().rstrip()) for _ in range(A)]
T = [int(sys.stdin.readline().rstrip()) for _ in range(B)]

def solver(S, A, x):
    d = []
    a = bisect.bisect_right(S, x)

    if a == A:
        d.append((-1, x - S[-1]))
    elif a == 0:
        d.append((1, S[0] - x))
    else:
        d.append((-1, x - S[a - 1]))
        d.append((1, S[a] - x))

    return d

for _ in range(Q):
    ans = 0
    x = int(sys.stdin.readline().rstrip())

    d_a = solver(S, A, x)
    d_b = solver(T, B, x)

    ans = 10**15
    for i, j in d_a:
        for k, l in d_b:
            if i == k:
                ans = min(ans, max(j, l))
            else:
                ans = min(ans, j + l + min(j, l))
    print(ans)