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()))



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 s[s_idx+0],s[s_idx+1]:

        for k in t[t_idx+0],t[t_idx+1]:

            ans = min(ans,abs(x[i] - j) + abs(j - k),abs(x[i] - k) + abs(j - k))

            

    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()))
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 s[s_idx + 0], s[s_idx + 1]:
        for k in t[t_idx + 0], t[t_idx + 1]:
            ans = min(ans, abs(x[i] - j) + abs(j - k), abs(x[i] - k) + abs(j - k))
    print(ans)

-    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]), -            ) +    for j in s[s_idx + 0], s[s_idx + 1]: +        for k in t[t_idx + 0], t[t_idx + 1]: +            ans = min(ans, abs(x[i] - j) + abs(j - k), abs(x[i] - k) + abs(j - k))