import sys

stdin = sys.stdin

 

sys.setrecursionlimit(10**5) 

 

def li(): return list(map(int, stdin.readline().split()))

def li_(): return [int(x)-1 for x in stdin.readline().split()]

def lf(): return list(map(float, stdin.readline().split()))

def ls(): return stdin.readline().split()

def ns(): return stdin.readline().rstrip()

def lc(): return list(ns())

def ni(): return int(stdin.readline())

def nf(): return float(stdin.readline())



from bisect import bisect_right



a,b,q = li()

s = [ni() for _ in range(a)]

t = [ni() for _ in range(b)]

query = [ni() for _ in range(q)]



for qi in query:

    shrine_right = float('inf')

    temple_right = float('inf')

    

    shrine_right_idx = bisect_right(s, qi)

    temple_right_idx = bisect_right(t, qi)

    

    if shrine_right_idx < a:

        shrine_right = s[shrine_right_idx]

        

    if temple_right_idx < b:

        temple_right = t[temple_right_idx]

    

    shrine_left = float('inf')

    temple_left = float('inf')

    

    if shrine_right_idx > 0:

        shrine_left = s[shrine_right_idx - 1]

        

    if temple_right_idx > 0:

        temple_left = t[temple_right_idx - 1] 

        

    cand = []

    

    # 前前

    cand.append(max(abs(qi - shrine_left), abs(qi - temple_left)))

    

    # 前後

    cand.append(abs(temple_right-shrine_left) + min(abs(qi - shrine_left), abs(qi - temple_right)))

    

    # 後前

    cand.append(abs(shrine_right-temple_left) + min(abs(qi - temple_left), abs(qi - shrine_right)))

    

    # 後後

    cand.append(max(abs(qi - shrine_right), abs(qi - temple_right)))

        

    print((min(cand)))
import sys

stdin = sys.stdin



sys.setrecursionlimit(10 ** 7)



def li(): return list(map(int, stdin.readline().split()))

def li_(): return [int(x) - 1 for x in stdin.readline().split()]

def lf(): return list(map(float, stdin.readline().split()))

def ls(): return stdin.readline().split()

def ns(): return stdin.readline().rstrip()

def lc(): return list(ns())

def ni(): return int(stdin.readline())

def nf(): return float(stdin.readline())



from bisect import bisect_left



def find_left_right(lis: list, pos: int):

    left_idx = bisect_left(lis, pos) - 1

    left = lis[left_idx]

    right = lis[left_idx+1]

    return left, right



def find_min(sh_l, sh_r, tm_l, tm_r, x):

    ret = 10**18

    ret = min(ret, max(x-sh_l, x-tm_l))

    ret = min(ret, (tm_r - sh_l + min(x-sh_l, tm_r-x)))

    ret = min(ret, (sh_r - tm_l + min(x-tm_l, sh_r-x)))

    ret = min(ret, max(sh_r-x, tm_r-x))



    return ret



a,b,q = li()

INF = 10**18

s = [-INF] + [ni() for _ in range(a)] + [INF]

t = [-INF] + [ni() for _ in range(b)] + [INF]

x = [ni() for _ in range(q)]



for xi in x:

    shrine_left, shrine_right = find_left_right(s, xi)

    temple_left, temple_right = find_left_right(t, xi)

    print((find_min(shrine_left, shrine_right, temple_left, temple_right, xi)))

import sys

stdin = sys.stdin
sys.setrecursionlimit(10**5)


def li():
    return list(map(int, stdin.readline().split()))


def li_():
    return [int(x) - 1 for x in stdin.readline().split()]


def lf():
    return list(map(float, stdin.readline().split()))


def ls():
    return stdin.readline().split()


def ns():
    return stdin.readline().rstrip()


def lc():
    return list(ns())


def ni():
    return int(stdin.readline())


def nf():
    return float(stdin.readline())


from bisect import bisect_right

a, b, q = li()
s = [ni() for _ in range(a)]
t = [ni() for _ in range(b)]
query = [ni() for _ in range(q)]
for qi in query:
    shrine_right = float("inf")
    temple_right = float("inf")
    shrine_right_idx = bisect_right(s, qi)
    temple_right_idx = bisect_right(t, qi)
    if shrine_right_idx < a:
        shrine_right = s[shrine_right_idx]
    if temple_right_idx < b:
        temple_right = t[temple_right_idx]
    shrine_left = float("inf")
    temple_left = float("inf")
    if shrine_right_idx > 0:
        shrine_left = s[shrine_right_idx - 1]
    if temple_right_idx > 0:
        temple_left = t[temple_right_idx - 1]
    cand = []
    # 前前
    cand.append(max(abs(qi - shrine_left), abs(qi - temple_left)))
    # 前後
    cand.append(
        abs(temple_right - shrine_left)
        + min(abs(qi - shrine_left), abs(qi - temple_right))
    )
    # 後前
    cand.append(
        abs(shrine_right - temple_left)
        + min(abs(qi - temple_left), abs(qi - shrine_right))
    )
    # 後後
    cand.append(max(abs(qi - shrine_right), abs(qi - temple_right)))
    print((min(cand)))

import sys

stdin = sys.stdin
sys.setrecursionlimit(10**7)


def li():
    return list(map(int, stdin.readline().split()))


def li_():
    return [int(x) - 1 for x in stdin.readline().split()]


def lf():
    return list(map(float, stdin.readline().split()))


def ls():
    return stdin.readline().split()


def ns():
    return stdin.readline().rstrip()


def lc():
    return list(ns())


def ni():
    return int(stdin.readline())


def nf():
    return float(stdin.readline())


from bisect import bisect_left


def find_left_right(lis: list, pos: int):
    left_idx = bisect_left(lis, pos) - 1
    left = lis[left_idx]
    right = lis[left_idx + 1]
    return left, right


def find_min(sh_l, sh_r, tm_l, tm_r, x):
    ret = 10**18
    ret = min(ret, max(x - sh_l, x - tm_l))
    ret = min(ret, (tm_r - sh_l + min(x - sh_l, tm_r - x)))
    ret = min(ret, (sh_r - tm_l + min(x - tm_l, sh_r - x)))
    ret = min(ret, max(sh_r - x, tm_r - x))
    return ret


a, b, q = li()
INF = 10**18
s = [-INF] + [ni() for _ in range(a)] + [INF]
t = [-INF] + [ni() for _ in range(b)] + [INF]
x = [ni() for _ in range(q)]
for xi in x:
    shrine_left, shrine_right = find_left_right(s, xi)
    temple_left, temple_right = find_left_right(t, xi)
    print((find_min(shrine_left, shrine_right, temple_left, temple_right, xi)))

-sys.setrecursionlimit(10**5) +sys.setrecursionlimit(10**7) -from bisect import bisect_right +from bisect import bisect_left + + +def find_left_right(lis: list, pos: int): +    left_idx = bisect_left(lis, pos) - 1 +    left = lis[left_idx] +    right = lis[left_idx + 1] +    return left, right + + +def find_min(sh_l, sh_r, tm_l, tm_r, x): +    ret = 10**18 +    ret = min(ret, max(x - sh_l, x - tm_l)) +    ret = min(ret, (tm_r - sh_l + min(x - sh_l, tm_r - x))) +    ret = min(ret, (sh_r - tm_l + min(x - tm_l, sh_r - x))) +    ret = min(ret, max(sh_r - x, tm_r - x)) +    return ret + -s = [ni() for _ in range(a)] -t = [ni() for _ in range(b)] -query = [ni() for _ in range(q)] -for qi in query: -    shrine_right = float("inf") -    temple_right = float("inf") -    shrine_right_idx = bisect_right(s, qi) -    temple_right_idx = bisect_right(t, qi) -    if shrine_right_idx < a: -        shrine_right = s[shrine_right_idx] -    if temple_right_idx < b: -        temple_right = t[temple_right_idx] -    shrine_left = float("inf") -    temple_left = float("inf") -    if shrine_right_idx > 0: -        shrine_left = s[shrine_right_idx - 1] -    if temple_right_idx > 0: -        temple_left = t[temple_right_idx - 1] -    cand = [] -    # 前前 -    cand.append(max(abs(qi - shrine_left), abs(qi - temple_left))) -    # 前後 -    cand.append( -        abs(temple_right - shrine_left) -        + min(abs(qi - shrine_left), abs(qi - temple_right)) -    ) -    # 後前 -    cand.append( -        abs(shrine_right - temple_left) -        + min(abs(qi - temple_left), abs(qi - shrine_right)) -    ) -    # 後後 -    cand.append(max(abs(qi - shrine_right), abs(qi - temple_right))) -    print((min(cand))) +INF = 10**18 +s = [-INF] + [ni() for _ in range(a)] + [INF] +t = [-INF] + [ni() for _ in range(b)] + [INF] +x = [ni() for _ in range(q)] +for xi in x: +    shrine_left, shrine_right = find_left_right(s, xi) +    temple_left, temple_right = find_left_right(t, xi) +    print((find_min(shrine_left, shrine_right, temple_left, temple_right, xi)))