# 二部探索問題



# from bisect import bisect_right as binarysearch

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



"""

自分で作ったやつは遅い

"""

def binarysearch(ls,x):

    n = len(ls)

    left = 0

    right = n

    pos = (right+left)//2

    while True:

        if ls[pos] < x < ls[pos+1]:

            index = pos

            break    

        elif x < ls[pos]:

            right = pos

        elif ls[pos+1] < x:

            left = pos

        pos = (right+left)//2

    return index









ss = [-10**10]+[int(eval(input())) for _ in range(A)]+[2*10**10]

ts = [-10**10]+[int(eval(input())) for _ in range(B)]+[2*10**10]

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

for x in xs:

    sind = binarysearch(ss,x)

    tind = binarysearch(ts,x)

    

    s0,s1,t0,t1 = ss[sind],ss[sind+1],ts[tind],ts[tind+1]

    # d1,d2,d3,d4 = 10**10,10**10,10**10,10**10

    # print("s",s0,x,s1)

    # print("t",t0,x,t1)

    d1 = max(x-s0,x-t0)

    d2 = min((t1-x)*2+(x-s0),(x-s0)*2+(t1-x))

    d3 = min((s1-x)*2+(x-t0),(x-t0)*2+(s1-x))

    d4 = max(s1-x, t1-x)

    print((min(d1,d2,d3,d4)))

import sys

from bisect import bisect_left

from bisect import bisect_right

input = sys.stdin.readline

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

INF = 10**20

ss = [-INF] + [int(eval(input())) for i in range(a)] + [INF]

ts = [-INF] + [int(eval(input())) for i in range(b)] + [INF]

xs = [int(eval(input())) for i in range(q)] 



ans = INF

for x in xs:

    si = bisect_left(ss, x)

    ti = bisect_left(ts, x)



    dist1 = abs(x-ss[si-1]) + 2*abs(x-ts[ti])

    dist2 = 2*abs(x-ss[si-1]) + abs(x-ts[ti])

    dist3 = abs(x-ts[ti-1]) + 2*abs(x-ss[si])

    dist4 = 2*abs(x-ts[ti-1]) + abs(x-ss[si])

    dist5 = max(abs(x-ss[si-1]), abs(x-ts[ti-1]))

    dist6 = max(abs(x-ss[si]), abs(x-ts[ti]))

    dist = min(dist1,dist2,dist3,dist4,dist5,dist6)

    # print(dist,"du",x,dist1,dist2,dist3,dist4,dist5,dist6)

    print(dist)





# 二部探索問題
# from bisect import bisect_right as binarysearch
A, B, Q = list(map(int, input().split()))
"""
自分で作ったやつは遅い
"""


def binarysearch(ls, x):
    n = len(ls)
    left = 0
    right = n
    pos = (right + left) // 2
    while True:
        if ls[pos] < x < ls[pos + 1]:
            index = pos
            break
        elif x < ls[pos]:
            right = pos
        elif ls[pos + 1] < x:
            left = pos
        pos = (right + left) // 2
    return index


ss = [-(10**10)] + [int(eval(input())) for _ in range(A)] + [2 * 10**10]
ts = [-(10**10)] + [int(eval(input())) for _ in range(B)] + [2 * 10**10]
xs = [int(eval(input())) for _ in range(Q)]
for x in xs:
    sind = binarysearch(ss, x)
    tind = binarysearch(ts, x)
    s0, s1, t0, t1 = ss[sind], ss[sind + 1], ts[tind], ts[tind + 1]
    # d1,d2,d3,d4 = 10**10,10**10,10**10,10**10
    # print("s",s0,x,s1)
    # print("t",t0,x,t1)
    d1 = max(x - s0, x - t0)
    d2 = min((t1 - x) * 2 + (x - s0), (x - s0) * 2 + (t1 - x))
    d3 = min((s1 - x) * 2 + (x - t0), (x - t0) * 2 + (s1 - x))
    d4 = max(s1 - x, t1 - x)
    print((min(d1, d2, d3, d4)))

import sys
from bisect import bisect_left
from bisect import bisect_right

input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
INF = 10**20
ss = [-INF] + [int(eval(input())) for i in range(a)] + [INF]
ts = [-INF] + [int(eval(input())) for i in range(b)] + [INF]
xs = [int(eval(input())) for i in range(q)]
ans = INF
for x in xs:
    si = bisect_left(ss, x)
    ti = bisect_left(ts, x)
    dist1 = abs(x - ss[si - 1]) + 2 * abs(x - ts[ti])
    dist2 = 2 * abs(x - ss[si - 1]) + abs(x - ts[ti])
    dist3 = abs(x - ts[ti - 1]) + 2 * abs(x - ss[si])
    dist4 = 2 * abs(x - ts[ti - 1]) + abs(x - ss[si])
    dist5 = max(abs(x - ss[si - 1]), abs(x - ts[ti - 1]))
    dist6 = max(abs(x - ss[si]), abs(x - ts[ti]))
    dist = min(dist1, dist2, dist3, dist4, dist5, dist6)
    # print(dist,"du",x,dist1,dist2,dist3,dist4,dist5,dist6)
    print(dist)

-# 二部探索問題 -# from bisect import bisect_right as binarysearch -A, B, Q = list(map(int, input().split())) -""" -自分で作ったやつは遅い -""" +import sys +from bisect import bisect_left +from bisect import bisect_right - -def binarysearch(ls, x): -    n = len(ls) -    left = 0 -    right = n -    pos = (right + left) // 2 -    while True: -        if ls[pos] < x < ls[pos + 1]: -            index = pos -            break -        elif x < ls[pos]: -            right = pos -        elif ls[pos + 1] < x: -            left = pos -        pos = (right + left) // 2 -    return index - - -ss = [-(10**10)] + [int(eval(input())) for _ in range(A)] + [2 * 10**10] -ts = [-(10**10)] + [int(eval(input())) for _ in range(B)] + [2 * 10**10] -xs = [int(eval(input())) for _ in range(Q)] +input = sys.stdin.readline +a, b, q = list(map(int, input().split())) +INF = 10**20 +ss = [-INF] + [int(eval(input())) for i in range(a)] + [INF] +ts = [-INF] + [int(eval(input())) for i in range(b)] + [INF] +xs = [int(eval(input())) for i in range(q)] +ans = INF -    sind = binarysearch(ss, x) -    tind = binarysearch(ts, x) -    s0, s1, t0, t1 = ss[sind], ss[sind + 1], ts[tind], ts[tind + 1] -    # d1,d2,d3,d4 = 10**10,10**10,10**10,10**10 -    # print("s",s0,x,s1) -    # print("t",t0,x,t1) -    d1 = max(x - s0, x - t0) -    d2 = min((t1 - x) * 2 + (x - s0), (x - s0) * 2 + (t1 - x)) -    d3 = min((s1 - x) * 2 + (x - t0), (x - t0) * 2 + (s1 - x)) -    d4 = max(s1 - x, t1 - x) -    print((min(d1, d2, d3, d4))) +    si = bisect_left(ss, x) +    ti = bisect_left(ts, x) +    dist1 = abs(x - ss[si - 1]) + 2 * abs(x - ts[ti]) +    dist2 = 2 * abs(x - ss[si - 1]) + abs(x - ts[ti]) +    dist3 = abs(x - ts[ti - 1]) + 2 * abs(x - ss[si]) +    dist4 = 2 * abs(x - ts[ti - 1]) + abs(x - ss[si]) +    dist5 = max(abs(x - ss[si - 1]), abs(x - ts[ti - 1])) +    dist6 = max(abs(x - ss[si]), abs(x - ts[ti])) +    dist = min(dist1, dist2, dist3, dist4, dist5, dist6) +    # print(dist,"du",x,dist1,dist2,dist3,dist4,dist5,dist6) +    print(dist)