import bisect

from itertools import product

I = lambda n: [int(eval(input())) for _ in range(n)]

def f(S, x):

    p = bisect.bisect_left(S, x)

    return [S[p-1], S[p]]

g = lambda x, s, t: abs(x-s)+abs(s-t)

INF = 10**11

a, b, q = list(map(int, input().split()))

S, T, X = [-INF]+I(a)+[INF], [-INF]+I(b)+[INF], I(q)

for x in X:

    min_ = INF

    for s, t in product(f(S, x), f(T, x)):

        min_ = min(min_, g(x, s, t), g(x, t, s))

    print(min_)
from bisect import bisect_left

from itertools import product

I = lambda n: [int(eval(input())) for _ in range(n)]

def f(S, x):

    p = bisect_left(S, x)

    return [S[p-1], S[p]]

g = lambda x, s, t: abs(x-s)+abs(s-t)

INF = 10**11

a, b, q = list(map(int, input().split()))

S, T, X = [-INF]+I(a)+[INF], [-INF]+I(b)+[INF], I(q)

for x in X:

    min_ = INF

    for s, t in product(f(S, x), f(T, x)):

        min_ = min(min_, g(x, s, t), g(x, t, s))

    print(min_)
import bisect
from itertools import product

I = lambda n: [int(eval(input())) for _ in range(n)]


def f(S, x):
    p = bisect.bisect_left(S, x)
    return [S[p - 1], S[p]]


g = lambda x, s, t: abs(x - s) + abs(s - t)
INF = 10**11
a, b, q = list(map(int, input().split()))
S, T, X = [-INF] + I(a) + [INF], [-INF] + I(b) + [INF], I(q)
for x in X:
    min_ = INF
    for s, t in product(f(S, x), f(T, x)):
        min_ = min(min_, g(x, s, t), g(x, t, s))
    print(min_)

from bisect import bisect_left
from itertools import product

I = lambda n: [int(eval(input())) for _ in range(n)]


def f(S, x):
    p = bisect_left(S, x)
    return [S[p - 1], S[p]]


g = lambda x, s, t: abs(x - s) + abs(s - t)
INF = 10**11
a, b, q = list(map(int, input().split()))
S, T, X = [-INF] + I(a) + [INF], [-INF] + I(b) + [INF], I(q)
for x in X:
    min_ = INF
    for s, t in product(f(S, x), f(T, x)):
        min_ = min(min_, g(x, s, t), g(x, t, s))
    print(min_)

-import bisect +from bisect import bisect_left -    p = bisect.bisect_left(S, x) +    p = bisect_left(S, x)