import bisect



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

S = [int(eval(input())) for _ in range(A)]

T = [int(eval(input())) for _ in range(B)]

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

"""

def bsr(a, v, lo=0, hi=None):

	if None == hi:

		hi = len(a) - 1

	while lo <= hi:

		mi = (lo + hi) // 2

		if a[mi] <= v:

			lo = mi + 1

		else:

			hi = mi - 1

	return lo

"""

bsr = bisect.bisect_right



INF = 10 ** 18

s = [-INF] + S + [INF]

t = [-INF] + T + [INF]



for x in X:

	sp = bsr(s, x)

	tp = bsr(t, x)

	cost = []

	cost += [abs(s[sp - 0] - x) + abs(s[sp - 0] - t[tp - 0])]

	cost += [abs(s[sp - 1] - x) + abs(s[sp - 1] - t[tp - 0])]

	cost += [abs(s[sp - 0] - x) + abs(s[sp - 0] - t[tp - 1])]

	cost += [abs(s[sp - 1] - x) + abs(s[sp - 1] - t[tp - 1])]

	cost += [abs(t[tp - 0] - x) + abs(s[sp - 0] - t[tp - 0])]

	cost += [abs(t[tp - 1] - x) + abs(s[sp - 0] - t[tp - 1])]

	cost += [abs(t[tp - 0] - x) + abs(s[sp - 1] - t[tp - 0])]

	cost += [abs(t[tp - 1] - x) + abs(s[sp - 1] - t[tp - 1])]

	print((min(cost)))

# お約束

INF = float("inf")

MOD = int(1e9 + 7)

def int1(n):

    return int(n) - 1

def parse(args, *params):

    return tuple(p(v) for p, v in zip(params, next(args).split()))



from bisect import bisect_right as bsr



# エントリーポイント

def main(args):

    A, B, Q = parse(args, int, int, int)

    S = list(int(next(args)) for _ in range(A))

    T = list(int(next(args)) for _ in range(B))

    X = tuple(int(next(args)) for _ in range(Q))



    s = [-INF] + S + [INF]

    t = [-INF] + T + [INF]

    for x in X:

        sr = bsr(s, x)

        sl = sr - 1

        tr = bsr(t, x)

        tl = tr - 1

        min_cost = INF

        for st in [s[sl], s[sr]]:

            for tt in [t[tl], t[tr]]:

                min_cost = min(min_cost, abs(st - x) + abs(tt - st))

                min_cost = min(min_cost, abs(tt - x) + abs(tt - st))

        print(min_cost)



import sys

if __name__ == '__main__':

    main(iter(sys.stdin.read().split("\n")))

import bisect

A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
"""
def bsr(a, v, lo=0, hi=None):
	if None == hi:
		hi = len(a) - 1
	while lo <= hi:
		mi = (lo + hi) // 2
		if a[mi] <= v:
			lo = mi + 1
		else:
			hi = mi - 1
	return lo
"""
bsr = bisect.bisect_right
INF = 10**18
s = [-INF] + S + [INF]
t = [-INF] + T + [INF]
for x in X:
    sp = bsr(s, x)
    tp = bsr(t, x)
    cost = []
    cost += [abs(s[sp - 0] - x) + abs(s[sp - 0] - t[tp - 0])]
    cost += [abs(s[sp - 1] - x) + abs(s[sp - 1] - t[tp - 0])]
    cost += [abs(s[sp - 0] - x) + abs(s[sp - 0] - t[tp - 1])]
    cost += [abs(s[sp - 1] - x) + abs(s[sp - 1] - t[tp - 1])]
    cost += [abs(t[tp - 0] - x) + abs(s[sp - 0] - t[tp - 0])]
    cost += [abs(t[tp - 1] - x) + abs(s[sp - 0] - t[tp - 1])]
    cost += [abs(t[tp - 0] - x) + abs(s[sp - 1] - t[tp - 0])]
    cost += [abs(t[tp - 1] - x) + abs(s[sp - 1] - t[tp - 1])]
    print((min(cost)))

# お約束
INF = float("inf")
MOD = int(1e9 + 7)


def int1(n):
    return int(n) - 1


def parse(args, *params):
    return tuple(p(v) for p, v in zip(params, next(args).split()))


from bisect import bisect_right as bsr

# エントリーポイント
def main(args):
    A, B, Q = parse(args, int, int, int)
    S = list(int(next(args)) for _ in range(A))
    T = list(int(next(args)) for _ in range(B))
    X = tuple(int(next(args)) for _ in range(Q))
    s = [-INF] + S + [INF]
    t = [-INF] + T + [INF]
    for x in X:
        sr = bsr(s, x)
        sl = sr - 1
        tr = bsr(t, x)
        tl = tr - 1
        min_cost = INF
        for st in [s[sl], s[sr]]:
            for tt in [t[tl], t[tr]]:
                min_cost = min(min_cost, abs(st - x) + abs(tt - st))
                min_cost = min(min_cost, abs(tt - x) + abs(tt - st))
        print(min_cost)


import sys

if __name__ == "__main__":
    main(iter(sys.stdin.read().split("\n")))

-import bisect +# お約束 +INF = float("inf") +MOD = int(1e9 + 7) -A, B, Q = list(map(int, input().split())) -S = [int(eval(input())) for _ in range(A)] -T = [int(eval(input())) for _ in range(B)] -X = [int(eval(input())) for _ in range(Q)] -""" -def bsr(a, v, lo=0, hi=None): -	if None == hi: -		hi = len(a) - 1 -	while lo <= hi: -		mi = (lo + hi) // 2 -		if a[mi] <= v: -			lo = mi + 1 -		else: -			hi = mi - 1 -	return lo -""" -bsr = bisect.bisect_right -INF = 10**18 -s = [-INF] + S + [INF] -t = [-INF] + T + [INF] -for x in X: -    sp = bsr(s, x) -    tp = bsr(t, x) -    cost = [] -    cost += [abs(s[sp - 0] - x) + abs(s[sp - 0] - t[tp - 0])] -    cost += [abs(s[sp - 1] - x) + abs(s[sp - 1] - t[tp - 0])] -    cost += [abs(s[sp - 0] - x) + abs(s[sp - 0] - t[tp - 1])] -    cost += [abs(s[sp - 1] - x) + abs(s[sp - 1] - t[tp - 1])] -    cost += [abs(t[tp - 0] - x) + abs(s[sp - 0] - t[tp - 0])] -    cost += [abs(t[tp - 1] - x) + abs(s[sp - 0] - t[tp - 1])] -    cost += [abs(t[tp - 0] - x) + abs(s[sp - 1] - t[tp - 0])] -    cost += [abs(t[tp - 1] - x) + abs(s[sp - 1] - t[tp - 1])] -    print((min(cost))) + +def int1(n): +    return int(n) - 1 + + +def parse(args, *params): +    return tuple(p(v) for p, v in zip(params, next(args).split())) + + +from bisect import bisect_right as bsr + +# エントリーポイント +def main(args): +    A, B, Q = parse(args, int, int, int) +    S = list(int(next(args)) for _ in range(A)) +    T = list(int(next(args)) for _ in range(B)) +    X = tuple(int(next(args)) for _ in range(Q)) +    s = [-INF] + S + [INF] +    t = [-INF] + T + [INF] +    for x in X: +        sr = bsr(s, x) +        sl = sr - 1 +        tr = bsr(t, x) +        tl = tr - 1 +        min_cost = INF +        for st in [s[sl], s[sr]]: +            for tt in [t[tl], t[tr]]: +                min_cost = min(min_cost, abs(st - x) + abs(tt - st)) +                min_cost = min(min_cost, abs(tt - x) + abs(tt - st)) +        print(min_cost) + + +import sys + +if __name__ == "__main__": +    main(iter(sys.stdin.read().split("\n")))