import bisect

A, B, Q = map(int, input().split())
INF = 10**18
S = [-INF] + [int(input()) for i in range(A)] + [INF]
T = [-INF] + [int(input()) for i in range(B)] + [INF]
X = [int(input()) for i in range(Q)]


for x in X:
    d = float("inf")
    i = bisect.bisect_right(S, x)
    j = bisect.bisect_right(T, x)
    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(t-s)
            d = min(d, d1, d2)
    print(d) 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 = 10**18 INF 10**18 10 18 int(input()) for i in range(A) for i in range(A) i range(A) range A for i in range(A) int(input()) int input() input S = [-INF] + [int(input()) for i in range(A)] + [INF] S [-INF] + [int(input()) for i in range(A)] + [INF] [-INF] + [int(input()) for i in range(A)] [-INF] -INF INF [int(input()) for i in range(A)] [INF] INF int(input()) for i in range(B) for i in range(B) i range(B) range B for i in range(B) int(input()) int input() input T = [-INF] + [int(input()) for i in range(B)] + [INF] T [-INF] + [int(input()) for i in range(B)] + [INF] [-INF] + [int(input()) for i in range(B)] [-INF] -INF INF [int(input()) for i in range(B)] [INF] INF int(input()) for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) int(input()) int input() input X = [int(input()) for i in range(Q)] X [int(input()) for i in range(Q)] for x in X:
    d = float("inf")
    i = bisect.bisect_right(S, x)
    j = bisect.bisect_right(T, x)
    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(t-s)
            d = min(d, d1, d2)
    print(d) x X d = float("inf") d float("inf") float "inf" 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 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(t-s)
            d = min(d, 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(t-s)
            d = min(d, 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(t-s) d2 abs(t-x) + abs(t-s) abs(t-x) abs t-x t x abs(t-s) abs t-s t s d = min(d, d1, d2) d min(d, d1, d2) min d d1 d2 print(d) print d S = [-INF] + [int(input()) for i in range(A)] + [INF] [-INF] + [int(input()) for i in range(A)] + [INF] S j = bisect.bisect_right(T, x) bisect.bisect_right(T, x) j d2 = abs(t-x) + abs(t-s) abs(t-x) + abs(t-s) d2 B, Q = map(int, input().split()) map(int, input().split()) B Q = map(int, input().split()) map(int, input().split()) Q T = [-INF] + [int(input()) for i in range(B)] + [INF] [-INF] + [int(input()) for i in range(B)] + [INF] T A, B, Q = map(int, input().split()) map(int, input().split()) A X = [int(input()) for i in range(Q)] [int(input()) for i in range(Q)] X d = float("inf") float("inf") d d = min(d, d1, d2) min(d, d1, d2) d INF = 10**18 10**18 INF d1 = abs(s-x) + abs(t-s) abs(s-x) + abs(t-s) d1 i = bisect.bisect_right(S, x) bisect.bisect_right(S, x) i
import bisect

A, B, Q = map(int, input().split())
INF = 10**18
S = [-INF] + [int(input()) for i in range(A)] + [INF]
T = [-INF] + [int(input()) for i in range(B)] + [INF]
X = [int(input()) for i in range(Q)]


for x in X:
    d = float("inf")
    i = bisect.bisect_right(S, x)
    j = bisect.bisect_right(T, x)
    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(t-s)
            d = min(d, d1, d2)
    print(d)
