from bisect import bisect_left

INF = 10 ** 11

a, b, q = map(int, input().split())
s = [-INF] + [int(input()) for _ in range(a)] + [INF]
t = [-INF] + [int(input()) for _ in range(b)] + [INF]
x = [int(input()) for _ in range(q)]

for e in x:
    si = bisect_left(s, e)
    ti = bisect_left(t, e)

    ans = INF
    for ss in [s[si-1], s[si]]:
        for tt in [t[ti-1], t[ti]]:
            d1 = abs(e - ss) + abs(ss - tt)
            d2 = abs(e - tt) + abs(tt - ss)
            ans = min(ans, d1, d2)

    print(ans) from bisect import bisect_left INF = 10 ** 11 INF 10 ** 11 10 11 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 = [-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 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 e in x:
    si = bisect_left(s, e)
    ti = bisect_left(t, e)

    ans = INF
    for ss in [s[si-1], s[si]]:
        for tt in [t[ti-1], t[ti]]:
            d1 = abs(e - ss) + abs(ss - tt)
            d2 = abs(e - tt) + abs(tt - ss)
            ans = min(ans, d1, d2)

    print(ans) e x si = bisect_left(s, e) si bisect_left(s, e) bisect_left s e ti = bisect_left(t, e) ti bisect_left(t, e) bisect_left t e ans = INF ans INF for ss in [s[si-1], s[si]]:
        for tt in [t[ti-1], t[ti]]:
            d1 = abs(e - ss) + abs(ss - tt)
            d2 = abs(e - tt) + abs(tt - ss)
            ans = min(ans, d1, d2)

     ss [s[si-1], s[si]] s[si-1] s si-1 si 1 s[si] s si for tt in [t[ti-1], t[ti]]:
            d1 = abs(e - ss) + abs(ss - tt)
            d2 = abs(e - tt) + abs(tt - ss)
            ans = min(ans, d1, d2)

     tt [t[ti-1], t[ti]] t[ti-1] t ti-1 ti 1 t[ti] t ti d1 = abs(e - ss) + abs(ss - tt) d1 abs(e - ss) + abs(ss - tt) abs(e - ss) abs e - ss e ss abs(ss - tt) abs ss - tt ss tt d2 = abs(e - tt) + abs(tt - ss) d2 abs(e - tt) + abs(tt - ss) abs(e - tt) abs e - tt e tt abs(tt - ss) abs tt - ss tt ss ans = min(ans, d1, d2) ans min(ans, d1, d2) min ans d1 d2 print(ans) print ans b, q = map(int, input().split()) map(int, input().split()) b si = bisect_left(s, e) bisect_left(s, e) si q = map(int, input().split()) map(int, input().split()) q t = [-INF] + [int(input()) for _ in range(b)] + [INF] [-INF] + [int(input()) for _ in range(b)] + [INF] t ans = min(ans, d1, d2) min(ans, d1, d2) ans d2 = abs(e - tt) + abs(tt - ss) abs(e - tt) + abs(tt - ss) d2 a, b, q = map(int, input().split()) map(int, input().split()) a d1 = abs(e - ss) + abs(ss - tt) abs(e - ss) + abs(ss - tt) d1 INF = 10 ** 11 10 ** 11 INF s = [-INF] + [int(input()) for _ in range(a)] + [INF] [-INF] + [int(input()) for _ in range(a)] + [INF] s ti = bisect_left(t, e) bisect_left(t, e) ti x = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] x ans = INF INF ans
from bisect import bisect_left

INF = 10 ** 11

a, b, q = map(int, input().split())
s = [-INF] + [int(input()) for _ in range(a)] + [INF]
t = [-INF] + [int(input()) for _ in range(b)] + [INF]
x = [int(input()) for _ in range(q)]

for e in x:
    si = bisect_left(s, e)
    ti = bisect_left(t, e)

    ans = INF
    for ss in [s[si-1], s[si]]:
        for tt in [t[ti-1], t[ti]]:
            d1 = abs(e - ss) + abs(ss - tt)
            d2 = abs(e - tt) + abs(tt - ss)
            ans = min(ans, d1, d2)

    print(ans)
