import sys

import bisect

input = sys.stdin.readline



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



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

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

#x = [int(input()) for i in range(q)]



ans = 10**100



for i in range(q):

    x = int(eval(input()))

    ans = 10**100

    s_idx = bisect.bisect_left(s,x)

    t_idx = bisect.bisect_left(t,x)

    s_idx -= 1

    t_idx -= 1

    #print(x[i],s_idx,t_idx)

    for j in range(2):

        for k in range(2):

            ans = min(ans,abs(x - s[min(s_idx+j,a-1)]) + abs(s[min(s_idx+j,a-1)] - t[min(t_idx+k,b-1)]),abs(x - t[min(t_idx+k,b-1)]) + abs(s[min(s_idx+j,a-1)] - t[min(t_idx+k,b-1)]))

            

    print(ans)
import sys

import bisect

input = sys.stdin.readline



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



ans = 10**100



s = [-ans] + [int(eval(input())) for i in range(a)] + [ans]

t = [-ans] + [int(eval(input())) for i in range(b)] + [ans]

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





ans = 10**100



for i in range(q):

    ans = 10**100

    s_idx = bisect.bisect_left(s,x[i])

    t_idx = bisect.bisect_left(t,x[i])

    s_idx -= 1

    t_idx -= 1

    #print(x[i],s_idx,t_idx)

    for j in range(2):

        for k in range(2):

            ans = min(ans,abs(x[i] - s[s_idx+j]) + abs(s[s_idx+j] - t[t_idx+k]),abs(x[i] - t[t_idx+k]) + abs(s[s_idx+j] - t[t_idx+k]))

            

    print(ans)  
import sys
import bisect

input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(a)]
t = [int(eval(input())) for i in range(b)]
# x = [int(input()) for i in range(q)]
ans = 10**100
for i in range(q):
    x = int(eval(input()))
    ans = 10**100
    s_idx = bisect.bisect_left(s, x)
    t_idx = bisect.bisect_left(t, x)
    s_idx -= 1
    t_idx -= 1
    # print(x[i],s_idx,t_idx)
    for j in range(2):
        for k in range(2):
            ans = min(
                ans,
                abs(x - s[min(s_idx + j, a - 1)])
                + abs(s[min(s_idx + j, a - 1)] - t[min(t_idx + k, b - 1)]),
                abs(x - t[min(t_idx + k, b - 1)])
                + abs(s[min(s_idx + j, a - 1)] - t[min(t_idx + k, b - 1)]),
            )
    print(ans)

import sys
import bisect

input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
ans = 10**100
s = [-ans] + [int(eval(input())) for i in range(a)] + [ans]
t = [-ans] + [int(eval(input())) for i in range(b)] + [ans]
x = [int(eval(input())) for i in range(q)]
ans = 10**100
for i in range(q):
    ans = 10**100
    s_idx = bisect.bisect_left(s, x[i])
    t_idx = bisect.bisect_left(t, x[i])
    s_idx -= 1
    t_idx -= 1
    # print(x[i],s_idx,t_idx)
    for j in range(2):
        for k in range(2):
            ans = min(
                ans,
                abs(x[i] - s[s_idx + j]) + abs(s[s_idx + j] - t[t_idx + k]),
                abs(x[i] - t[t_idx + k]) + abs(s[s_idx + j] - t[t_idx + k]),
            )
    print(ans)

-s = [int(eval(input())) for i in range(a)] -t = [int(eval(input())) for i in range(b)] -# x = [int(input()) for i in range(q)] +ans = 10**100 +s = [-ans] + [int(eval(input())) for i in range(a)] + [ans] +t = [-ans] + [int(eval(input())) for i in range(b)] + [ans] +x = [int(eval(input())) for i in range(q)] -    x = int(eval(input())) -    s_idx = bisect.bisect_left(s, x) -    t_idx = bisect.bisect_left(t, x) +    s_idx = bisect.bisect_left(s, x[i]) +    t_idx = bisect.bisect_left(t, x[i]) -                abs(x - s[min(s_idx + j, a - 1)]) -                + abs(s[min(s_idx + j, a - 1)] - t[min(t_idx + k, b - 1)]), -                abs(x - t[min(t_idx + k, b - 1)]) -                + abs(s[min(s_idx + j, a - 1)] - t[min(t_idx + k, b - 1)]), +                abs(x[i] - s[s_idx + j]) + abs(s[s_idx + j] - t[t_idx + k]), +                abs(x[i] - t[t_idx + k]) + abs(s[s_idx + j] - t[t_idx + k]),