import numpy as np


def check(x, al, bl):
    rcost = np.inf
    for a in al:
        tmp_c = abs(a - x)
        for b in bl:
            t = abs(b - a)
            rcost = min(rcost, tmp_c + t, abs(b - x) + t)

    print(int(rcost))


n = [int(each) for each in input().split()]
a, b, q = n[0], n[1], n[2]

sl = np.zeros(a)
tl = np.zeros(b)
xl = np.zeros(q)

for i in range(a):
    sl[i] = int(input())
for i in range(b):
    tl[i] = int(input())
for i in range(q):
    xl[i] = int(input())

result = []
for x in xl:
    check(x, sl, tl)
