A, B, Q = map(int, input().split())
s = []
for _ in range(A):
    s.append(int(input()))
t = []
for _ in range(B):
    t.append(int(input()))
x = []
for _ in range(Q):
    x.append(int(input()))

def binsearch(threshold, lst):
    left, right = -1, len(lst)

    while right - left > 1:
        mid = (left + right) // 2
        if lst[mid] > threshold:
            right = mid
        else:
            left = mid
    return (left, right)

for q in x:
    ans = 10 ** 11
    for i in range(2):
        for j in range(2):
            a = binsearch(q, s)[i]
            b = binsearch(q, t)[j]
            #print(i, j, a, b)
            if 0 <= a <= A - 1 and 0 <= b <= B - 1:
                    #print(s[a], t[b], q)
                    ans = min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q)))
    print(ans) A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q s = [] s [] for _ in range(A):
    s.append(int(input())) _ range(A) range A s.append(int(input())) s.append s append int(input()) int input() input t = [] t [] for _ in range(B):
    t.append(int(input())) _ range(B) range B t.append(int(input())) t.append t append int(input()) int input() input x = [] x [] for _ in range(Q):
    x.append(int(input())) _ range(Q) range Q x.append(int(input())) x.append x append int(input()) int input() input def binsearch(threshold, lst):
    left, right = -1, len(lst)

    while right - left > 1:
        mid = (left + right) // 2
        if lst[mid] > threshold:
            right = mid
        else:
            left = mid
    return (left, right) binsearch left, right = -1, len(lst) left -1 right len(lst) len lst while right - left > 1:
        mid = (left + right) // 2
        if lst[mid] > threshold:
            right = mid
        else:
            left = mid
     right - left > 1 right - left right left 1 mid = (left + right) // 2 mid (left + right) // 2 left + right left right 2 if lst[mid] > threshold:
            right = mid
        else:
            left = mid
     lst[mid] > threshold lst[mid] lst mid threshold right = mid right mid left = mid left mid return (left, right) (left, right) left right threshold threshold lst lst for q in x:
    ans = 10 ** 11
    for i in range(2):
        for j in range(2):
            a = binsearch(q, s)[i]
            b = binsearch(q, t)[j]
            #print(i, j, a, b)
            if 0 <= a <= A - 1 and 0 <= b <= B - 1:
                    #print(s[a], t[b], q)
                    ans = min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q)))
    print(ans) q x ans = 10 ** 11 ans 10 ** 11 10 11 for i in range(2):
        for j in range(2):
            a = binsearch(q, s)[i]
            b = binsearch(q, t)[j]
            #print(i, j, a, b)
            if 0 <= a <= A - 1 and 0 <= b <= B - 1:
                    #print(s[a], t[b], q)
                    ans = min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q)))
     i range(2) range 2 for j in range(2):
            a = binsearch(q, s)[i]
            b = binsearch(q, t)[j]
            #print(i, j, a, b)
            if 0 <= a <= A - 1 and 0 <= b <= B - 1:
                    #print(s[a], t[b], q)
                    ans = min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q)))
     j range(2) range 2 a = binsearch(q, s)[i] a binsearch(q, s)[i] (q, s) binsearch q s i b = binsearch(q, t)[j] b binsearch(q, t)[j] (q, t) binsearch q t j if 0 <= a <= A - 1 and 0 <= b <= B - 1:
                    #print(s[a], t[b], q)
                    ans = min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q)))
     0 <= a <= A - 1 and 0 <= b <= B - 1 0 <= a <= A - 1 0 <= a 0 a A - 1 A 1 0 <= b <= B - 1 0 <= b 0 b B - 1 B 1 ans = min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q))) ans min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q))) min ans abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q)) abs(s[a] -t[b]) abs s[a] -t[b] s[a] s a t[b] t b min(abs(s[a]-q), abs(t[b]-q)) min abs(s[a]-q) abs s[a]-q s[a] s a q abs(t[b]-q) abs t[b]-q t[b] t b q print(ans) print ans a = binsearch(q, s)[i] binsearch(q, s)[i] a x = [] [] x B, Q = map(int, input().split()) map(int, input().split()) B A, B, Q = map(int, input().split()) map(int, input().split()) A def binsearch(threshold, lst):
    left, right = -1, len(lst)

    while right - left > 1:
        mid = (left + right) // 2
        if lst[mid] > threshold:
            right = mid
        else:
            left = mid
    return (left, right) def binsearch(threshold, lst):
    left, right = -1, len(lst)

    while right - left > 1:
        mid = (left + right) // 2
        if lst[mid] > threshold:
            right = mid
        else:
            left = mid
    return (left, right) binsearch Q = map(int, input().split()) map(int, input().split()) Q s = [] [] s t = [] [] t ans = 10 ** 11 10 ** 11 ans b = binsearch(q, t)[j] binsearch(q, t)[j] b ans = min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q))) min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q))) ans
A, B, Q = map(int, input().split())
s = []
for _ in range(A):
    s.append(int(input()))
t = []
for _ in range(B):
    t.append(int(input()))
x = []
for _ in range(Q):
    x.append(int(input()))

def binsearch(threshold, lst):
    left, right = -1, len(lst)

    while right - left > 1:
        mid = (left + right) // 2
        if lst[mid] > threshold:
            right = mid
        else:
            left = mid
    return (left, right)

for q in x:
    ans = 10 ** 11
    for i in range(2):
        for j in range(2):
            a = binsearch(q, s)[i]
            b = binsearch(q, t)[j]
            #print(i, j, a, b)
            if 0 <= a <= A - 1 and 0 <= b <= B - 1:
                    #print(s[a], t[b], q)
                    ans = min(ans, abs(s[a] -t[b]) + min(abs(s[a]-q), abs(t[b]-q)))
    print(ans)