import bisect

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

s = [- 10 ** 19]
for i in range(a):
    s.append(int(input()))
s.append(10 ** 19)

t = [- 10 ** 19]
for i in range(b):
    t.append(int(input()))
t.append(10 ** 19)

for i in range(q):
    x = int(input())
    ps = bisect.bisect_right(s, x)
    pt = bisect.bisect_right(t, x)
    ret = 10 ** 19
    for loc1 in (s[ps], s[ps-1]):
        for loc2 in (t[pt], t[pt-1]):
            val = min(abs(x-loc1) + abs(loc1-loc2),
                      abs(x-loc2) + abs(loc1-loc2))
            ret = min(ret, val)
    print(ret) import bisect bisect a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q s = [- 10 ** 19] s [- 10 ** 19] - 10 ** 19 - 10 19 for i in range(a):
    s.append(int(input())) i range(a) range a s.append(int(input())) s.append s append int(input()) int input() input s.append(10 ** 19) s.append s append 10 ** 19 10 19 t = [- 10 ** 19] t [- 10 ** 19] - 10 ** 19 - 10 19 for i in range(b):
    t.append(int(input())) i range(b) range b t.append(int(input())) t.append t append int(input()) int input() input t.append(10 ** 19) t.append t append 10 ** 19 10 19 for i in range(q):
    x = int(input())
    ps = bisect.bisect_right(s, x)
    pt = bisect.bisect_right(t, x)
    ret = 10 ** 19
    for loc1 in (s[ps], s[ps-1]):
        for loc2 in (t[pt], t[pt-1]):
            val = min(abs(x-loc1) + abs(loc1-loc2),
                      abs(x-loc2) + abs(loc1-loc2))
            ret = min(ret, val)
    print(ret) i range(q) range q x = int(input()) x int(input()) int input() input ps = bisect.bisect_right(s, x) ps bisect.bisect_right(s, x) bisect.bisect_right bisect bisect_right s x pt = bisect.bisect_right(t, x) pt bisect.bisect_right(t, x) bisect.bisect_right bisect bisect_right t x ret = 10 ** 19 ret 10 ** 19 10 19 for loc1 in (s[ps], s[ps-1]):
        for loc2 in (t[pt], t[pt-1]):
            val = min(abs(x-loc1) + abs(loc1-loc2),
                      abs(x-loc2) + abs(loc1-loc2))
            ret = min(ret, val)
     loc1 (s[ps], s[ps-1]) s[ps] s ps s[ps-1] s ps-1 ps 1 for loc2 in (t[pt], t[pt-1]):
            val = min(abs(x-loc1) + abs(loc1-loc2),
                      abs(x-loc2) + abs(loc1-loc2))
            ret = min(ret, val)
     loc2 (t[pt], t[pt-1]) t[pt] t pt t[pt-1] t pt-1 pt 1 val = min(abs(x-loc1) + abs(loc1-loc2),
                      abs(x-loc2) + abs(loc1-loc2)) val min(abs(x-loc1) + abs(loc1-loc2),
                      abs(x-loc2) + abs(loc1-loc2)) min abs(x-loc1) + abs(loc1-loc2) abs(x-loc1) abs x-loc1 x loc1 abs(loc1-loc2) abs loc1-loc2 loc1 loc2 abs(x-loc2) + abs(loc1-loc2) abs(x-loc2) abs x-loc2 x loc2 abs(loc1-loc2) abs loc1-loc2 loc1 loc2 ret = min(ret, val) ret min(ret, val) min ret val print(ret) print ret ret = 10 ** 19 10 ** 19 ret b, q = map(int, input().split()) map(int, input().split()) b val = min(abs(x-loc1) + abs(loc1-loc2),
                      abs(x-loc2) + abs(loc1-loc2)) min(abs(x-loc1) + abs(loc1-loc2),
                      abs(x-loc2) + abs(loc1-loc2)) val a, b, q = map(int, input().split()) map(int, input().split()) a s = [- 10 ** 19] [- 10 ** 19] s ret = min(ret, val) min(ret, val) ret pt = bisect.bisect_right(t, x) bisect.bisect_right(t, x) pt q = map(int, input().split()) map(int, input().split()) q t = [- 10 ** 19] [- 10 ** 19] t x = int(input()) int(input()) x ps = bisect.bisect_right(s, x) bisect.bisect_right(s, x) ps
import bisect

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

s = [- 10 ** 19]
for i in range(a):
    s.append(int(input()))
s.append(10 ** 19)

t = [- 10 ** 19]
for i in range(b):
    t.append(int(input()))
t.append(10 ** 19)

for i in range(q):
    x = int(input())
    ps = bisect.bisect_right(s, x)
    pt = bisect.bisect_right(t, x)
    ret = 10 ** 19
    for loc1 in (s[ps], s[ps-1]):
        for loc2 in (t[pt], t[pt-1]):
            val = min(abs(x-loc1) + abs(loc1-loc2),
                      abs(x-loc2) + abs(loc1-loc2))
            ret = min(ret, val)
    print(ret)
