import bisect



f_inf = float('inf')





def cal(syurui, d, index):

    if d == 'e':

        return syurui[index]

    elif d == 'w':

        return syurui[index - 1]





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

s = [int(eval(input())) for i in range(A)]

s.sort()

t = [int(eval(input())) for i in range(B)]

t.sort()

ｓ.insert(0, -f_inf)

t.insert(0, -f_inf)

ｓ.append(f_inf)

t.append(f_inf)



for i in range(Q):

    x = int(eval(input()))

    s_index = bisect.bisect_left(s, x)

    t_index = bisect.bisect_left(t, x)

    print((min(max(abs(x-s[s_index]), abs(x-t[t_index])), max(abs(x-s[s_index-1]), abs(x-t[t_index-1])), 2*abs(x-s[s_index-1])+abs(x-t[t_index]), 2*abs(x-s[s_index])+abs(x-t[t_index-1]), abs(x-s[s_index-1])+2*abs(x-t[t_index]), abs(x-s[s_index])+2*abs(x-t[t_index-1]))))

import bisect

import sys



f_inf = float('inf')





def cal(syurui, d, index):

    if d == 'e':

        return syurui[index]

    elif d == 'w':

        return syurui[index - 1]





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

s = [int(eval(input())) for i in range(A)]

s.sort()

t = [int(eval(input())) for i in range(B)]

t.sort()

ｓ.insert(0, -f_inf)

t.insert(0, -f_inf)

ｓ.append(f_inf)

t.append(f_inf)



for i in range(Q):

    x = int(sys.stdin.readline().rstrip('\n'))

    s_index = bisect.bisect_left(s, x)

    t_index = bisect.bisect_left(t, x)

    print((min(max(abs(x - s[s_index]), abs(x - t[t_index])), max(abs(x - s[s_index - 1]), abs(x - t[t_index - 1])), 2 * abs(x - s[s_index - 1]) + abs(x - t[t_index]),

              2 * abs(x - s[s_index]) + abs(x - t[t_index - 1]), abs(x - s[s_index - 1]) + 2 * abs(x - t[t_index]), abs(x - s[s_index]) + 2 * abs(x - t[t_index - 1]))))

import bisect

f_inf = float("inf")


def cal(syurui, d, index):
    if d == "e":
        return syurui[index]
    elif d == "w":
        return syurui[index - 1]


A, B, Q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(A)]
s.sort()
t = [int(eval(input())) for i in range(B)]
t.sort()
ｓ.insert(0, -f_inf)
t.insert(0, -f_inf)
ｓ.append(f_inf)
t.append(f_inf)
for i in range(Q):
    x = int(eval(input()))
    s_index = bisect.bisect_left(s, x)
    t_index = bisect.bisect_left(t, x)
    print(
        (
            min(
                max(abs(x - s[s_index]), abs(x - t[t_index])),
                max(abs(x - s[s_index - 1]), abs(x - t[t_index - 1])),
                2 * abs(x - s[s_index - 1]) + abs(x - t[t_index]),
                2 * abs(x - s[s_index]) + abs(x - t[t_index - 1]),
                abs(x - s[s_index - 1]) + 2 * abs(x - t[t_index]),
                abs(x - s[s_index]) + 2 * abs(x - t[t_index - 1]),
            )
        )
    )

import bisect
import sys

f_inf = float("inf")


def cal(syurui, d, index):
    if d == "e":
        return syurui[index]
    elif d == "w":
        return syurui[index - 1]


A, B, Q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(A)]
s.sort()
t = [int(eval(input())) for i in range(B)]
t.sort()
ｓ.insert(0, -f_inf)
t.insert(0, -f_inf)
ｓ.append(f_inf)
t.append(f_inf)
for i in range(Q):
    x = int(sys.stdin.readline().rstrip("\n"))
    s_index = bisect.bisect_left(s, x)
    t_index = bisect.bisect_left(t, x)
    print(
        (
            min(
                max(abs(x - s[s_index]), abs(x - t[t_index])),
                max(abs(x - s[s_index - 1]), abs(x - t[t_index - 1])),
                2 * abs(x - s[s_index - 1]) + abs(x - t[t_index]),
                2 * abs(x - s[s_index]) + abs(x - t[t_index - 1]),
                abs(x - s[s_index - 1]) + 2 * abs(x - t[t_index]),
                abs(x - s[s_index]) + 2 * abs(x - t[t_index - 1]),
            )
        )
    )

+import sys -    x = int(eval(input())) +    x = int(sys.stdin.readline().rstrip("\n"))