import sys
input = lambda: sys.stdin.readline().rstrip()
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 i in range(Q):
    ans = INF
    x = int(input())
    s_right = bisect.bisect_right(s, x)
    t_right = bisect.bisect_right(t, x)

    s_left = s_right - 1
    t_left = t_right - 1

    for S in (s[s_left], s[s_right]):
        for T in (t[t_left], t[t_right]):
            ans = min(ans, abs(x-S) + abs(T-S), abs(x-T) + abs(S-T))

    print(ans) import sys sys input = lambda: sys.stdin.readline().rstrip() input lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip 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 i in range(Q):
    ans = INF
    x = int(input())
    s_right = bisect.bisect_right(s, x)
    t_right = bisect.bisect_right(t, x)

    s_left = s_right - 1
    t_left = t_right - 1

    for S in (s[s_left], s[s_right]):
        for T in (t[t_left], t[t_right]):
            ans = min(ans, abs(x-S) + abs(T-S), abs(x-T) + abs(S-T))

    print(ans) i range(Q) range Q ans = INF ans INF x = int(input()) x int(input()) int input() input s_right = bisect.bisect_right(s, x) s_right bisect.bisect_right(s, x) bisect.bisect_right bisect bisect_right s x t_right = bisect.bisect_right(t, x) t_right bisect.bisect_right(t, x) bisect.bisect_right bisect bisect_right t x s_left = s_right - 1 s_left s_right - 1 s_right 1 t_left = t_right - 1 t_left t_right - 1 t_right 1 for S in (s[s_left], s[s_right]):
        for T in (t[t_left], t[t_right]):
            ans = min(ans, abs(x-S) + abs(T-S), abs(x-T) + abs(S-T))

     S (s[s_left], s[s_right]) s[s_left] s s_left s[s_right] s s_right for T in (t[t_left], t[t_right]):
            ans = min(ans, abs(x-S) + abs(T-S), abs(x-T) + abs(S-T))

     T (t[t_left], t[t_right]) t[t_left] t t_left t[t_right] t t_right ans = min(ans, abs(x-S) + abs(T-S), abs(x-T) + abs(S-T)) ans min(ans, abs(x-S) + abs(T-S), abs(x-T) + abs(S-T)) min ans abs(x-S) + abs(T-S) abs(x-S) abs x-S x S abs(T-S) abs T-S T S abs(x-T) + abs(S-T) abs(x-T) abs x-T x T abs(S-T) abs S-T S T print(ans) print ans ans = min(ans, abs(x-S) + abs(T-S), abs(x-T) + abs(S-T)) min(ans, abs(x-S) + abs(T-S), abs(x-T) + abs(S-T)) ans t = [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] + [INF] t ans = INF INF ans input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input Q = map(int, input().split()) map(int, input().split()) Q x = int(input()) int(input()) x s_right = bisect.bisect_right(s, x) bisect.bisect_right(s, x) s_right A, B, Q = map(int, input().split()) map(int, input().split()) A s = [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] + [INF] s t_right = bisect.bisect_right(t, x) bisect.bisect_right(t, x) t_right s_left = s_right - 1 s_right - 1 s_left INF = float("inf") float("inf") INF t_left = t_right - 1 t_right - 1 t_left B, Q = map(int, input().split()) map(int, input().split()) B
import sys
input = lambda: sys.stdin.readline().rstrip()
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 i in range(Q):
    ans = INF
    x = int(input())
    s_right = bisect.bisect_right(s, x)
    t_right = bisect.bisect_right(t, x)

    s_left = s_right - 1
    t_left = t_right - 1

    for S in (s[s_left], s[s_right]):
        for T in (t[t_left], t[t_right]):
            ans = min(ans, abs(x-S) + abs(T-S), abs(x-T) + abs(S-T))

    print(ans)