from bisect import bisect_left

a, b, q = map(int, input().split())
dummy = 10 ** 18 + 1
s = [-dummy] + [int(input()) for _ in range(a)] + [dummy]
t = [-dummy] + [int(input()) for _ in range(b)] + [dummy]
x = [int(input()) for _ in range(q)]

for i in x:
    # 神社から先に行くパターン
    idx_s, idx_t = bisect_left(s, i), bisect_left(t, i)
    ans = dummy
    for j in [s[idx_s-1], s[idx_s]]:
        for k in [t[idx_t-1], t[idx_t]]:
            res1, res2 = abs(j - i) + abs(k - j), abs(k - i) + abs(j - k)
            ans = min(ans, res1, res2)
    print(ans) from bisect import bisect_left a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q dummy = 10 ** 18 + 1 dummy 10 ** 18 + 1 10 ** 18 10 18 1 int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input s = [-dummy] + [int(input()) for _ in range(a)] + [dummy] s [-dummy] + [int(input()) for _ in range(a)] + [dummy] [-dummy] + [int(input()) for _ in range(a)] [-dummy] -dummy dummy [int(input()) for _ in range(a)] [dummy] dummy int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t = [-dummy] + [int(input()) for _ in range(b)] + [dummy] t [-dummy] + [int(input()) for _ in range(b)] + [dummy] [-dummy] + [int(input()) for _ in range(b)] [-dummy] -dummy dummy [int(input()) for _ in range(b)] [dummy] dummy 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 i in x:
    # 神社から先に行くパターン
    idx_s, idx_t = bisect_left(s, i), bisect_left(t, i)
    ans = dummy
    for j in [s[idx_s-1], s[idx_s]]:
        for k in [t[idx_t-1], t[idx_t]]:
            res1, res2 = abs(j - i) + abs(k - j), abs(k - i) + abs(j - k)
            ans = min(ans, res1, res2)
    print(ans) i x idx_s, idx_t = bisect_left(s, i), bisect_left(t, i) idx_s bisect_left(s, i) bisect_left s i idx_t bisect_left(t, i) bisect_left t i ans = dummy ans dummy for j in [s[idx_s-1], s[idx_s]]:
        for k in [t[idx_t-1], t[idx_t]]:
            res1, res2 = abs(j - i) + abs(k - j), abs(k - i) + abs(j - k)
            ans = min(ans, res1, res2)
     j [s[idx_s-1], s[idx_s]] s[idx_s-1] s idx_s-1 idx_s 1 s[idx_s] s idx_s for k in [t[idx_t-1], t[idx_t]]:
            res1, res2 = abs(j - i) + abs(k - j), abs(k - i) + abs(j - k)
            ans = min(ans, res1, res2)
     k [t[idx_t-1], t[idx_t]] t[idx_t-1] t idx_t-1 idx_t 1 t[idx_t] t idx_t res1, res2 = abs(j - i) + abs(k - j), abs(k - i) + abs(j - k) res1 abs(j - i) + abs(k - j) abs(j - i) abs j - i j i abs(k - j) abs k - j k j res2 abs(k - i) + abs(j - k) abs(k - i) abs k - i k i abs(j - k) abs j - k j k ans = min(ans, res1, res2) ans min(ans, res1, res2) min ans res1 res2 print(ans) print ans idx_t = bisect_left(s, i), bisect_left(t, i) bisect_left(t, i) idx_t t = [-dummy] + [int(input()) for _ in range(b)] + [dummy] [-dummy] + [int(input()) for _ in range(b)] + [dummy] t ans = dummy dummy ans idx_s, idx_t = bisect_left(s, i), bisect_left(t, i) bisect_left(s, i) idx_s x = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] x b, q = map(int, input().split()) map(int, input().split()) b a, b, q = map(int, input().split()) map(int, input().split()) a res1, res2 = abs(j - i) + abs(k - j), abs(k - i) + abs(j - k) abs(j - i) + abs(k - j) res1 ans = min(ans, res1, res2) min(ans, res1, res2) ans dummy = 10 ** 18 + 1 10 ** 18 + 1 dummy q = map(int, input().split()) map(int, input().split()) q s = [-dummy] + [int(input()) for _ in range(a)] + [dummy] [-dummy] + [int(input()) for _ in range(a)] + [dummy] s res2 = abs(j - i) + abs(k - j), abs(k - i) + abs(j - k) abs(k - i) + abs(j - k) res2
from bisect import bisect_left

a, b, q = map(int, input().split())
dummy = 10 ** 18 + 1
s = [-dummy] + [int(input()) for _ in range(a)] + [dummy]
t = [-dummy] + [int(input()) for _ in range(b)] + [dummy]
x = [int(input()) for _ in range(q)]

for i in x:
    # 神社から先に行くパターン
    idx_s, idx_t = bisect_left(s, i), bisect_left(t, i)
    ans = dummy
    for j in [s[idx_s-1], s[idx_s]]:
        for k in [t[idx_t-1], t[idx_t]]:
            res1, res2 = abs(j - i) + abs(k - j), abs(k - i) + abs(j - k)
            ans = min(ans, res1, res2)
    print(ans)
