import sys

from bisect import bisect_left

inpurt = sys.stdin.readline

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

INF = 10 ** 11

s = [-INF]

s_append = s.append

for i in range(a):

    si = int(eval(input()))

    s_append(si)

s_append(INF)

t = [-INF]

t_append = t.append

for i in range(b):

    ti = int(eval(input()))

    t_append(ti)

t_append(INF)

x = []

x_append = x.append

for i in range(q):

    xi = int(eval(input()))

    x_append(xi)



for xi in x:

    index_s = bisect_left(s, xi)

    s1 = xi - s[index_s - 1]

    s2 = s[index_s] - xi

    index_t = bisect_left(t, xi)

    t1 = xi - t[index_t - 1]

    t2 = t[index_t] -xi

    print((min(max(s1, t1), max(s2, t2), min(s1, t2) * 2 + max(s1, t2), min(s2, t1) * 2 + max(s2, t1))))

import sys

from bisect import bisect_left

inpurt = sys.stdin.readline

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

INF = 10 ** 11

s = [-INF] + [int(eval(input())) for _ in range(a)] + [INF]

t = [-INF] + [int(eval(input())) for _ in range(b)] + [INF]

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



for xi in x:

    index_s = bisect_left(s, xi)

    s1 = xi - s[index_s - 1]

    s2 = s[index_s] - xi

    index_t = bisect_left(t, xi)

    t1 = xi - t[index_t - 1]

    t2 = t[index_t] -xi

    print((min(max(s1, t1), max(s2, t2), min(s1, t2) * 2 + max(s1, t2), min(s2, t1) * 2 + max(s2, t1))))

import sys
from bisect import bisect_left

inpurt = sys.stdin.readline
a, b, q = list(map(int, input().split()))
INF = 10**11
s = [-INF]
s_append = s.append
for i in range(a):
    si = int(eval(input()))
    s_append(si)
s_append(INF)
t = [-INF]
t_append = t.append
for i in range(b):
    ti = int(eval(input()))
    t_append(ti)
t_append(INF)
x = []
x_append = x.append
for i in range(q):
    xi = int(eval(input()))
    x_append(xi)
for xi in x:
    index_s = bisect_left(s, xi)
    s1 = xi - s[index_s - 1]
    s2 = s[index_s] - xi
    index_t = bisect_left(t, xi)
    t1 = xi - t[index_t - 1]
    t2 = t[index_t] - xi
    print(
        (
            min(
                max(s1, t1),
                max(s2, t2),
                min(s1, t2) * 2 + max(s1, t2),
                min(s2, t1) * 2 + max(s2, t1),
            )
        )
    )

import sys
from bisect import bisect_left

inpurt = sys.stdin.readline
a, b, q = list(map(int, input().split()))
INF = 10**11
s = [-INF] + [int(eval(input())) for _ in range(a)] + [INF]
t = [-INF] + [int(eval(input())) for _ in range(b)] + [INF]
x = [int(eval(input())) for _ in range(q)]
for xi in x:
    index_s = bisect_left(s, xi)
    s1 = xi - s[index_s - 1]
    s2 = s[index_s] - xi
    index_t = bisect_left(t, xi)
    t1 = xi - t[index_t - 1]
    t2 = t[index_t] - xi
    print(
        (
            min(
                max(s1, t1),
                max(s2, t2),
                min(s1, t2) * 2 + max(s1, t2),
                min(s2, t1) * 2 + max(s2, t1),
            )
        )
    )

-s = [-INF] -s_append = s.append -for i in range(a): -    si = int(eval(input())) -    s_append(si) -s_append(INF) -t = [-INF] -t_append = t.append -for i in range(b): -    ti = int(eval(input())) -    t_append(ti) -t_append(INF) -x = [] -x_append = x.append -for i in range(q): -    xi = int(eval(input())) -    x_append(xi) +s = [-INF] + [int(eval(input())) for _ in range(a)] + [INF] +t = [-INF] + [int(eval(input())) for _ in range(b)] + [INF] +x = [int(eval(input())) for _ in range(q)]