#!/usr/bin/env python3
import bisect

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

s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]

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

s.sort()
t.sort()

i = 0


for i in range(len(x)):

    r_shrine = bisect.bisect_right(s, x[i])
    r_temple = bisect.bisect_right(t, x[i])

    l_shrine = r_shrine-1
    l_temple = r_temple-1

    # print(l_shrine, r_shrine)
    # print(l_temple, r_temple)

    ans = []
    if l_shrine >= 0 and l_temple >= 0:
        ans.append(max(x[i]-s[l_shrine], x[i]-t[l_temple]))  # <<
    if r_shrine < a and r_temple < b:
        ans.append(max(s[r_shrine]-x[i], t[r_temple]-x[i]))  # >>
    if l_shrine >= 0 and r_temple < b:
        min_ = min(x[i]-s[l_shrine], t[r_temple]-x[i])
        ans.append(min_+(t[r_temple]-s[l_shrine]))  # <>
    if r_shrine < a and l_temple >= 0:
        min_ = min(x[i]-t[l_temple], s[r_shrine]-x[i])
        ans.append(min_+(s[r_shrine]-t[l_temple]))  # <>

    print(min(ans)) import bisect bisect a, b, q = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split b q int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input s = [int(input()) for _ in range(a)] s [int(input()) for _ in range(a)] int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t = [int(input()) for _ in range(b)] t [int(input()) for _ in range(b)] int(input()) for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) int(input()) int input() input x = [int(input()) for _ in range(q)] x [int(input()) for _ in range(q)] s.sort() s.sort s sort t.sort() t.sort t sort i = 0 i 0 for i in range(len(x)):

    r_shrine = bisect.bisect_right(s, x[i])
    r_temple = bisect.bisect_right(t, x[i])

    l_shrine = r_shrine-1
    l_temple = r_temple-1

    # print(l_shrine, r_shrine)
    # print(l_temple, r_temple)

    ans = []
    if l_shrine >= 0 and l_temple >= 0:
        ans.append(max(x[i]-s[l_shrine], x[i]-t[l_temple]))  # <<
    if r_shrine < a and r_temple < b:
        ans.append(max(s[r_shrine]-x[i], t[r_temple]-x[i]))  # >>
    if l_shrine >= 0 and r_temple < b:
        min_ = min(x[i]-s[l_shrine], t[r_temple]-x[i])
        ans.append(min_+(t[r_temple]-s[l_shrine]))  # <>
    if r_shrine < a and l_temple >= 0:
        min_ = min(x[i]-t[l_temple], s[r_shrine]-x[i])
        ans.append(min_+(s[r_shrine]-t[l_temple]))  # <>

    print(min(ans)) i range(len(x)) range len(x) len x r_shrine = bisect.bisect_right(s, x[i]) r_shrine bisect.bisect_right(s, x[i]) bisect.bisect_right bisect bisect_right s x[i] x i r_temple = bisect.bisect_right(t, x[i]) r_temple bisect.bisect_right(t, x[i]) bisect.bisect_right bisect bisect_right t x[i] x i l_shrine = r_shrine-1 l_shrine r_shrine-1 r_shrine 1 l_temple = r_temple-1 l_temple r_temple-1 r_temple 1 ans = [] ans [] if l_shrine >= 0 and l_temple >= 0:
        ans.append(max(x[i]-s[l_shrine], x[i]-t[l_temple]))  # <<
     l_shrine >= 0 and l_temple >= 0 l_shrine >= 0 l_shrine 0 l_temple >= 0 l_temple 0 ans.append(max(x[i]-s[l_shrine], x[i]-t[l_temple])) ans.append ans append max(x[i]-s[l_shrine], x[i]-t[l_temple]) max x[i]-s[l_shrine] x[i] x i s[l_shrine] s l_shrine x[i]-t[l_temple] x[i] x i t[l_temple] t l_temple if r_shrine < a and r_temple < b:
        ans.append(max(s[r_shrine]-x[i], t[r_temple]-x[i]))  # >>
     r_shrine < a and r_temple < b r_shrine < a r_shrine a r_temple < b r_temple b ans.append(max(s[r_shrine]-x[i], t[r_temple]-x[i])) ans.append ans append max(s[r_shrine]-x[i], t[r_temple]-x[i]) max s[r_shrine]-x[i] s[r_shrine] s r_shrine x[i] x i t[r_temple]-x[i] t[r_temple] t r_temple x[i] x i if l_shrine >= 0 and r_temple < b:
        min_ = min(x[i]-s[l_shrine], t[r_temple]-x[i])
        ans.append(min_+(t[r_temple]-s[l_shrine]))  # <>
     l_shrine >= 0 and r_temple < b l_shrine >= 0 l_shrine 0 r_temple < b r_temple b min_ = min(x[i]-s[l_shrine], t[r_temple]-x[i]) min_ min(x[i]-s[l_shrine], t[r_temple]-x[i]) min x[i]-s[l_shrine] x[i] x i s[l_shrine] s l_shrine t[r_temple]-x[i] t[r_temple] t r_temple x[i] x i ans.append(min_+(t[r_temple]-s[l_shrine])) ans.append ans append min_+(t[r_temple]-s[l_shrine]) min_ t[r_temple]-s[l_shrine] t[r_temple] t r_temple s[l_shrine] s l_shrine if r_shrine < a and l_temple >= 0:
        min_ = min(x[i]-t[l_temple], s[r_shrine]-x[i])
        ans.append(min_+(s[r_shrine]-t[l_temple]))  # <>

     r_shrine < a and l_temple >= 0 r_shrine < a r_shrine a l_temple >= 0 l_temple 0 min_ = min(x[i]-t[l_temple], s[r_shrine]-x[i]) min_ min(x[i]-t[l_temple], s[r_shrine]-x[i]) min x[i]-t[l_temple] x[i] x i t[l_temple] t l_temple s[r_shrine]-x[i] s[r_shrine] s r_shrine x[i] x i ans.append(min_+(s[r_shrine]-t[l_temple])) ans.append ans append min_+(s[r_shrine]-t[l_temple]) min_ s[r_shrine]-t[l_temple] s[r_shrine] s r_shrine t[l_temple] t l_temple print(min(ans)) print min(ans) min ans t = [int(input()) for _ in range(b)] [int(input()) for _ in range(b)] t r_shrine = bisect.bisect_right(s, x[i]) bisect.bisect_right(s, x[i]) r_shrine q = list(map(int, input().split())) list(map(int, input().split())) q r_temple = bisect.bisect_right(t, x[i]) bisect.bisect_right(t, x[i]) r_temple x = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] x b, q = list(map(int, input().split())) list(map(int, input().split())) b min_ = min(x[i]-t[l_temple], s[r_shrine]-x[i]) min(x[i]-t[l_temple], s[r_shrine]-x[i]) min_ a, b, q = list(map(int, input().split())) list(map(int, input().split())) a l_shrine = r_shrine-1 r_shrine-1 l_shrine l_temple = r_temple-1 r_temple-1 l_temple ans = [] [] ans s = [int(input()) for _ in range(a)] [int(input()) for _ in range(a)] s i = 0 0 i min_ = min(x[i]-s[l_shrine], t[r_temple]-x[i]) min(x[i]-s[l_shrine], t[r_temple]-x[i]) min_
#!/usr/bin/env python3
import bisect

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

s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]

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

s.sort()
t.sort()

i = 0


for i in range(len(x)):

    r_shrine = bisect.bisect_right(s, x[i])
    r_temple = bisect.bisect_right(t, x[i])

    l_shrine = r_shrine-1
    l_temple = r_temple-1

    # print(l_shrine, r_shrine)
    # print(l_temple, r_temple)

    ans = []
    if l_shrine >= 0 and l_temple >= 0:
        ans.append(max(x[i]-s[l_shrine], x[i]-t[l_temple]))  # <<
    if r_shrine < a and r_temple < b:
        ans.append(max(s[r_shrine]-x[i], t[r_temple]-x[i]))  # >>
    if l_shrine >= 0 and r_temple < b:
        min_ = min(x[i]-s[l_shrine], t[r_temple]-x[i])
        ans.append(min_+(t[r_temple]-s[l_shrine]))  # <>
    if r_shrine < a and l_temple >= 0:
        min_ = min(x[i]-t[l_temple], s[r_shrine]-x[i])
        ans.append(min_+(s[r_shrine]-t[l_temple]))  # <>

    print(min(ans))
