from bisect import bisect_left

a, b, q = map(int, input().split())
S = []
T = []
X = []


def calc(x, a, b):
    return abs(a - b) + min(abs(x - a), abs(x - b))


for _ in range(a):
    S.append(int(input()))
for _ in range(b):
    T.append(int(input()))
for _ in range(q):
    x = int(input())

    basho1 = bisect_left(S, x)
    basho11 = min(basho1, a - 1)
    basho12 = basho11 - 1

    basho2 = bisect_left(T, x)
    basho21 = min(basho2, b - 1)
    basho22 = basho21 - 1
    ans = calc(x, S[basho11], T[basho21])
    ans = min(ans, calc(x, S[basho11], T[basho22]))
    ans = min(ans, calc(x, S[basho12], T[basho21]))
    ans = min(ans, calc(x, S[basho12], T[basho22]))
    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 S = [] S [] T = [] T [] X = [] X [] def calc(x, a, b):
    return abs(a - b) + min(abs(x - a), abs(x - b)) calc return abs(a - b) + min(abs(x - a), abs(x - b)) abs(a - b) + min(abs(x - a), abs(x - b)) abs(a - b) abs a - b a b min(abs(x - a), abs(x - b)) min abs(x - a) abs x - a x a abs(x - b) abs x - b x b x x a a b b for _ in range(a):
    S.append(int(input())) _ range(a) range a S.append(int(input())) S.append S append int(input()) int input() input for _ in range(b):
    T.append(int(input())) _ range(b) range b T.append(int(input())) T.append T append int(input()) int input() input for _ in range(q):
    x = int(input())

    basho1 = bisect_left(S, x)
    basho11 = min(basho1, a - 1)
    basho12 = basho11 - 1

    basho2 = bisect_left(T, x)
    basho21 = min(basho2, b - 1)
    basho22 = basho21 - 1
    ans = calc(x, S[basho11], T[basho21])
    ans = min(ans, calc(x, S[basho11], T[basho22]))
    ans = min(ans, calc(x, S[basho12], T[basho21]))
    ans = min(ans, calc(x, S[basho12], T[basho22]))
    print(ans) _ range(q) range q x = int(input()) x int(input()) int input() input basho1 = bisect_left(S, x) basho1 bisect_left(S, x) bisect_left S x basho11 = min(basho1, a - 1) basho11 min(basho1, a - 1) min basho1 a - 1 a 1 basho12 = basho11 - 1 basho12 basho11 - 1 basho11 1 basho2 = bisect_left(T, x) basho2 bisect_left(T, x) bisect_left T x basho21 = min(basho2, b - 1) basho21 min(basho2, b - 1) min basho2 b - 1 b 1 basho22 = basho21 - 1 basho22 basho21 - 1 basho21 1 ans = calc(x, S[basho11], T[basho21]) ans calc(x, S[basho11], T[basho21]) calc x S[basho11] S basho11 T[basho21] T basho21 ans = min(ans, calc(x, S[basho11], T[basho22])) ans min(ans, calc(x, S[basho11], T[basho22])) min ans calc(x, S[basho11], T[basho22]) calc x S[basho11] S basho11 T[basho22] T basho22 ans = min(ans, calc(x, S[basho12], T[basho21])) ans min(ans, calc(x, S[basho12], T[basho21])) min ans calc(x, S[basho12], T[basho21]) calc x S[basho12] S basho12 T[basho21] T basho21 ans = min(ans, calc(x, S[basho12], T[basho22])) ans min(ans, calc(x, S[basho12], T[basho22])) min ans calc(x, S[basho12], T[basho22]) calc x S[basho12] S basho12 T[basho22] T basho22 print(ans) print ans basho22 = basho21 - 1 basho21 - 1 basho22 ans = min(ans, calc(x, S[basho12], T[basho22])) min(ans, calc(x, S[basho12], T[basho22])) ans basho12 = basho11 - 1 basho11 - 1 basho12 basho21 = min(basho2, b - 1) min(basho2, b - 1) basho21 b, q = map(int, input().split()) map(int, input().split()) b basho2 = bisect_left(T, x) bisect_left(T, x) basho2 basho11 = min(basho1, a - 1) min(basho1, a - 1) basho11 ans = calc(x, S[basho11], T[basho21]) calc(x, S[basho11], T[basho21]) ans S = [] [] S T = [] [] T basho1 = bisect_left(S, x) bisect_left(S, x) basho1 ans = min(ans, calc(x, S[basho11], T[basho22])) min(ans, calc(x, S[basho11], T[basho22])) ans a, b, q = map(int, input().split()) map(int, input().split()) a q = map(int, input().split()) map(int, input().split()) q x = int(input()) int(input()) x def calc(x, a, b):
    return abs(a - b) + min(abs(x - a), abs(x - b)) def calc(x, a, b):
    return abs(a - b) + min(abs(x - a), abs(x - b)) calc X = [] [] X ans = min(ans, calc(x, S[basho12], T[basho21])) min(ans, calc(x, S[basho12], T[basho21])) ans
from bisect import bisect_left

a, b, q = map(int, input().split())
S = []
T = []
X = []


def calc(x, a, b):
    return abs(a - b) + min(abs(x - a), abs(x - b))


for _ in range(a):
    S.append(int(input()))
for _ in range(b):
    T.append(int(input()))
for _ in range(q):
    x = int(input())

    basho1 = bisect_left(S, x)
    basho11 = min(basho1, a - 1)
    basho12 = basho11 - 1

    basho2 = bisect_left(T, x)
    basho21 = min(basho2, b - 1)
    basho22 = basho21 - 1
    ans = calc(x, S[basho11], T[basho21])
    ans = min(ans, calc(x, S[basho11], T[basho22]))
    ans = min(ans, calc(x, S[basho12], T[basho21]))
    ans = min(ans, calc(x, S[basho12], T[basho22]))
    print(ans)
