# coding: utf-8
import sys
from bisect import bisect_left
import itertools

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 番兵を左右に置いて、4通り試す
A, B, Q = lr()
INF = 10 ** 12
S = [-INF] + [ir() for _ in range(A)] + [INF]
T = [-INF] + [ir() for _ in range(B)] + [INF]
S.sort(); T.sort()
for _ in range(Q):
    x = ir()
    si = bisect_left(S, x)
    ti = bisect_left(T, x)
    answer = INF
    for s, t in itertools.product(S[si-1:si+1], T[ti-1:ti+1]):
        temp = min(abs(s-x), abs(t-x)) + abs(s-t)
        if temp < answer:
            answer = temp
    print(answer)
#  import sys sys from bisect import bisect_left import itertools itertools sr = lambda: sys.stdin.readline().rstrip() sr 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 ir = lambda: int(sr()) ir lambda: int(sr()) int(sr()) int sr() sr lr = lambda: list(map(int, sr().split())) lr lambda: list(map(int, sr().split())) list(map(int, sr().split())) list map(int, sr().split()) map int sr().split() ().split () sr split A, B, Q = lr() A lr() lr B Q INF = 10 ** 12 INF 10 ** 12 10 12 ir() for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) ir() ir S = [-INF] + [ir() for _ in range(A)] + [INF] S [-INF] + [ir() for _ in range(A)] + [INF] [-INF] + [ir() for _ in range(A)] [-INF] -INF INF [ir() for _ in range(A)] [INF] INF ir() for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) ir() ir T = [-INF] + [ir() for _ in range(B)] + [INF] T [-INF] + [ir() for _ in range(B)] + [INF] [-INF] + [ir() for _ in range(B)] [-INF] -INF INF [ir() for _ in range(B)] [INF] INF S.sort() S.sort S sort T.sort() T.sort T sort for _ in range(Q):
    x = ir()
    si = bisect_left(S, x)
    ti = bisect_left(T, x)
    answer = INF
    for s, t in itertools.product(S[si-1:si+1], T[ti-1:ti+1]):
        temp = min(abs(s-x), abs(t-x)) + abs(s-t)
        if temp < answer:
            answer = temp
    print(answer)
#  _ range(Q) range Q x = ir() x ir() ir si = bisect_left(S, x) si bisect_left(S, x) bisect_left S x ti = bisect_left(T, x) ti bisect_left(T, x) bisect_left T x answer = INF answer INF for s, t in itertools.product(S[si-1:si+1], T[ti-1:ti+1]):
        temp = min(abs(s-x), abs(t-x)) + abs(s-t)
        if temp < answer:
            answer = temp
     s t itertools.product(S[si-1:si+1], T[ti-1:ti+1]) itertools.product itertools product S[si-1:si+1] S si-1:si+1 si-1 si 1 si+1 si 1 T[ti-1:ti+1] T ti-1:ti+1 ti-1 ti 1 ti+1 ti 1 temp = min(abs(s-x), abs(t-x)) + abs(s-t) temp min(abs(s-x), abs(t-x)) + abs(s-t) min(abs(s-x), abs(t-x)) min abs(s-x) abs s-x s x abs(t-x) abs t-x t x abs(s-t) abs s-t s t if temp < answer:
            answer = temp
     temp < answer temp answer answer = temp answer temp print(answer) print answer si = bisect_left(S, x) bisect_left(S, x) si A, B, Q = lr() lr() A ir = lambda: int(sr()) lambda: int(sr()) ir lr = lambda: list(map(int, sr().split())) lambda: list(map(int, sr().split())) lr S = [-INF] + [ir() for _ in range(A)] + [INF] [-INF] + [ir() for _ in range(A)] + [INF] S x = ir() ir() x answer = INF INF answer B, Q = lr() lr() B Q = lr() lr() Q ti = bisect_left(T, x) bisect_left(T, x) ti INF = 10 ** 12 10 ** 12 INF temp = min(abs(s-x), abs(t-x)) + abs(s-t) min(abs(s-x), abs(t-x)) + abs(s-t) temp sr = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() sr T = [-INF] + [ir() for _ in range(B)] + [INF] [-INF] + [ir() for _ in range(B)] + [INF] T answer = temp temp answer
# coding: utf-8
import sys
from bisect import bisect_left
import itertools

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 番兵を左右に置いて、4通り試す
A, B, Q = lr()
INF = 10 ** 12
S = [-INF] + [ir() for _ in range(A)] + [INF]
T = [-INF] + [ir() for _ in range(B)] + [INF]
S.sort(); T.sort()
for _ in range(Q):
    x = ir()
    si = bisect_left(S, x)
    ti = bisect_left(T, x)
    answer = INF
    for s, t in itertools.product(S[si-1:si+1], T[ti-1:ti+1]):
        temp = min(abs(s-x), abs(t-x)) + abs(s-t)
        if temp < answer:
            answer = temp
    print(answer)
# 
