a, b, q = map(int, input().split())
S = [int(input()) for _ in range(a)]
T = [int(input()) for _ in range(b)]
S.sort()
T.sort()
INF = 10**18
S = [-INF] + S + [INF]
T = [-INF] + T + [INF]

import bisect
for _ in range(q):
    x = int(input())
    i = bisect.bisect_right(S, x)
    j = bisect.bisect_right(T, x)
    ans = INF
    for s in [S[i-1], S[i]]:
        for t in [T[j-1], T[j]]:
            d1 = abs(s-x) + abs(t-s)
            d2 = abs(t-x) + abs(s-t)
            ans = min([ans, d1, d2])
    print(ans) 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)] S.sort() S.sort S sort T.sort() T.sort T sort INF = 10**18 INF 10**18 10 18 S = [-INF] + S + [INF] S [-INF] + S + [INF] [-INF] + S [-INF] -INF INF S [INF] INF T = [-INF] + T + [INF] T [-INF] + T + [INF] [-INF] + T [-INF] -INF INF T [INF] INF import bisect bisect for _ in range(q):
    x = int(input())
    i = bisect.bisect_right(S, x)
    j = bisect.bisect_right(T, x)
    ans = INF
    for s in [S[i-1], S[i]]:
        for t in [T[j-1], T[j]]:
            d1 = abs(s-x) + abs(t-s)
            d2 = abs(t-x) + abs(s-t)
            ans = min([ans, d1, d2])
    print(ans) _ range(q) range q x = int(input()) x int(input()) int input() input i = bisect.bisect_right(S, x) i bisect.bisect_right(S, x) bisect.bisect_right bisect bisect_right S x j = bisect.bisect_right(T, x) j bisect.bisect_right(T, x) bisect.bisect_right bisect bisect_right T x ans = INF ans INF for s in [S[i-1], S[i]]:
        for t in [T[j-1], T[j]]:
            d1 = abs(s-x) + abs(t-s)
            d2 = abs(t-x) + abs(s-t)
            ans = min([ans, d1, d2])
     s [S[i-1], S[i]] S[i-1] S i-1 i 1 S[i] S i for t in [T[j-1], T[j]]:
            d1 = abs(s-x) + abs(t-s)
            d2 = abs(t-x) + abs(s-t)
            ans = min([ans, d1, d2])
     t [T[j-1], T[j]] T[j-1] T j-1 j 1 T[j] T j d1 = abs(s-x) + abs(t-s) 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) d2 abs(t-x) + abs(s-t) abs(t-x) abs t-x t x abs(s-t) abs s-t s t ans = min([ans, d1, d2]) ans min([ans, d1, d2]) min [ans, d1, d2] ans d1 d2 print(ans) print ans d2 = abs(t-x) + abs(s-t) abs(t-x) + abs(s-t) d2 ans = INF INF ans S = [-INF] + S + [INF] [-INF] + S + [INF] S a, b, q = map(int, input().split()) map(int, input().split()) a x = int(input()) int(input()) x j = bisect.bisect_right(T, x) bisect.bisect_right(T, x) j T = [int(input()) for _ in range(b)] [int(input()) for _ in range(b)] T q = map(int, input().split()) map(int, input().split()) q b, q = map(int, input().split()) map(int, input().split()) b INF = 10**18 10**18 INF T = [-INF] + T + [INF] [-INF] + T + [INF] T ans = min([ans, d1, d2]) min([ans, d1, d2]) ans S = [int(input()) for _ in range(a)] [int(input()) for _ in range(a)] S i = bisect.bisect_right(S, x) bisect.bisect_right(S, x) i d1 = abs(s-x) + abs(t-s) abs(s-x) + abs(t-s) d1
a, b, q = map(int, input().split())
S = [int(input()) for _ in range(a)]
T = [int(input()) for _ in range(b)]
S.sort()
T.sort()
INF = 10**18
S = [-INF] + S + [INF]
T = [-INF] + T + [INF]

import bisect
for _ in range(q):
    x = int(input())
    i = bisect.bisect_right(S, x)
    j = bisect.bisect_right(T, x)
    ans = INF
    for s in [S[i-1], S[i]]:
        for t in [T[j-1], T[j]]:
            d1 = abs(s-x) + abs(t-s)
            d2 = abs(t-x) + abs(s-t)
            ans = min([ans, d1, d2])
    print(ans)