import bisect

A, B, Q = list(map(int, input().split()))

s = [-10**10 - 1, -10**10] + [int(eval(input())) for _ in range(A)] + [2*10**10]

t = [-10**10 - 1, -10**10] + [int(eval(input())) for _ in range(B)] + [2*10**10]

x = [int(eval(input())) for _ in range(Q)]





def func(c, d, z):

    i = bisect.bisect_left(c, z)

    j1 = bisect.bisect_left(d, c[i - 1])

    j2 = bisect.bisect_left(d, c[i])

    return min(z - d[j1 - 1], z - c[i - 1] * 2 + d[j1], d[j2] - z, c[i] * 2 - z - d[j2 - 1])





for z in x:

    print((min(func(s, t, z), func(t, s, z))))
import bisect

A, B, Q = list(map(int, input().split()))

s = [-10**10 - 1, -10**10] + [int(eval(input())) for _ in range(A)] + [2*10**10]

t = [-10**10 - 1, -10**10] + [int(eval(input())) for _ in range(B)] + [2*10**10]

x = [int(eval(input())) for _ in range(Q)]





def func(c, d, z):

    i = bisect.bisect_left(c, z)

    j = bisect.bisect_left(d, z)

    if c[i - 1] < d[j - 1] and c[i] < d[j]:

        return min(z - c[i - 1], z + c[i] - 2 * d[j - 1], 2 * c[i] - z - d[j - 1], d[j] - z)

    elif c[i - 1] < d[j - 1] and c[i] >= d[j]:

        return min(z - c[i - 1], z + c[i] - 2 * d[j - 1], 2 * d[j] - z - c[i - 1], c[i] - z)

    elif c[i - 1] >= d[j - 1] and c[i] < d[j]:

        return min(z - d[j - 1], z + d[j] - 2 * c[i - 1], 2 * c[i] - z - d[j - 1], d[j] - z)

    else:

        return min(z - d[j - 1], z + d[j] - 2 * c[i - 1], 2 * d[j] - z - c[i - 1], c[i] - z)





for z in x:

    print((func(s, t, z)))
import bisect

A, B, Q = list(map(int, input().split()))
s = (
    [-(10**10) - 1, -(10**10)]
    + [int(eval(input())) for _ in range(A)]
    + [2 * 10**10]
)
t = (
    [-(10**10) - 1, -(10**10)]
    + [int(eval(input())) for _ in range(B)]
    + [2 * 10**10]
)
x = [int(eval(input())) for _ in range(Q)]


def func(c, d, z):
    i = bisect.bisect_left(c, z)
    j1 = bisect.bisect_left(d, c[i - 1])
    j2 = bisect.bisect_left(d, c[i])
    return min(
        z - d[j1 - 1], z - c[i - 1] * 2 + d[j1], d[j2] - z, c[i] * 2 - z - d[j2 - 1]
    )


for z in x:
    print((min(func(s, t, z), func(t, s, z))))

import bisect

A, B, Q = list(map(int, input().split()))
s = (
    [-(10**10) - 1, -(10**10)]
    + [int(eval(input())) for _ in range(A)]
    + [2 * 10**10]
)
t = (
    [-(10**10) - 1, -(10**10)]
    + [int(eval(input())) for _ in range(B)]
    + [2 * 10**10]
)
x = [int(eval(input())) for _ in range(Q)]


def func(c, d, z):
    i = bisect.bisect_left(c, z)
    j = bisect.bisect_left(d, z)
    if c[i - 1] < d[j - 1] and c[i] < d[j]:
        return min(
            z - c[i - 1], z + c[i] - 2 * d[j - 1], 2 * c[i] - z - d[j - 1], d[j] - z
        )
    elif c[i - 1] < d[j - 1] and c[i] >= d[j]:
        return min(
            z - c[i - 1], z + c[i] - 2 * d[j - 1], 2 * d[j] - z - c[i - 1], c[i] - z
        )
    elif c[i - 1] >= d[j - 1] and c[i] < d[j]:
        return min(
            z - d[j - 1], z + d[j] - 2 * c[i - 1], 2 * c[i] - z - d[j - 1], d[j] - z
        )
    else:
        return min(
            z - d[j - 1], z + d[j] - 2 * c[i - 1], 2 * d[j] - z - c[i - 1], c[i] - z
        )


for z in x:
    print((func(s, t, z)))

-    j1 = bisect.bisect_left(d, c[i - 1]) -    j2 = bisect.bisect_left(d, c[i]) -    return min( -        z - d[j1 - 1], z - c[i - 1] * 2 + d[j1], d[j2] - z, c[i] * 2 - z - d[j2 - 1] -    ) +    j = bisect.bisect_left(d, z) +    if c[i - 1] < d[j - 1] and c[i] < d[j]: +        return min( +            z - c[i - 1], z + c[i] - 2 * d[j - 1], 2 * c[i] - z - d[j - 1], d[j] - z +        ) +    elif c[i - 1] < d[j - 1] and c[i] >= d[j]: +        return min( +            z - c[i - 1], z + c[i] - 2 * d[j - 1], 2 * d[j] - z - c[i - 1], c[i] - z +        ) +    elif c[i - 1] >= d[j - 1] and c[i] < d[j]: +        return min( +            z - d[j - 1], z + d[j] - 2 * c[i - 1], 2 * c[i] - z - d[j - 1], d[j] - z +        ) +    else: +        return min( +            z - d[j - 1], z + d[j] - 2 * c[i - 1], 2 * d[j] - z - c[i - 1], c[i] - z +        ) -    print((min(func(s, t, z), func(t, s, z)))) +    print((func(s, t, z)))