import sys
input = sys.stdin.readline
A, B, Q = map(int, input().split())
inf = 10**18
S = [-inf]
for _ in range(A):
    S.append(int(input()))
S.append(inf)
T = [-inf]
for _ in range(B):
    T.append(int(input()))
T.append(inf)
def f_s(x, l):
    mn, mx = -1, len(l)
    idx = mx//2
    while mx-mn>1:
        if l[idx] < x:
            idx, mn = (idx + mx)//2, idx
            continue
        idx, mx = (idx + mn)//2, idx
    return idx

for _ in range(Q):
    q = int(input())
    xi, yi = f_s(q, S), f_s(q, T)
    s1, s2 = S[xi], S[xi+1]
    t1, t2 = T[yi], T[yi+1]
    print(min([
        max(q-s1,q-t1),
        max(s2-q, t2-q),
        2*(s2-q) + q-t1,
        2*(t2-q) + q-s1,
        2*(q-s1) + t2-q,
        2*(q-t1) + s2-q,
        ]))
#    print(q, s1, s2, t1, t2)

#    print(S[xi], T[yi]) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q inf = 10**18 inf 10**18 10 18 S = [-inf] S [-inf] -inf inf 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 S.append(inf) S.append S append inf T = [-inf] T [-inf] -inf inf 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 T.append(inf) T.append T append inf def f_s(x, l):
    mn, mx = -1, len(l)
    idx = mx//2
    while mx-mn>1:
        if l[idx] < x:
            idx, mn = (idx + mx)//2, idx
            continue
        idx, mx = (idx + mn)//2, idx
    return idx f_s mn, mx = -1, len(l) mn -1 mx len(l) len l idx = mx//2 idx mx//2 mx 2 while mx-mn>1:
        if l[idx] < x:
            idx, mn = (idx + mx)//2, idx
            continue
        idx, mx = (idx + mn)//2, idx
     mx-mn>1 mx-mn mx mn 1 if l[idx] < x:
            idx, mn = (idx + mx)//2, idx
            continue
         l[idx] < x l[idx] l idx x idx, mn = (idx + mx)//2, idx idx (idx + mx)//2 idx + mx idx mx 2 mn idx continue idx, mx = (idx + mn)//2, idx idx (idx + mn)//2 idx + mn idx mn 2 mx idx return idx idx x x l l for _ in range(Q):
    q = int(input())
    xi, yi = f_s(q, S), f_s(q, T)
    s1, s2 = S[xi], S[xi+1]
    t1, t2 = T[yi], T[yi+1]
    print(min([
        max(q-s1,q-t1),
        max(s2-q, t2-q),
        2*(s2-q) + q-t1,
        2*(t2-q) + q-s1,
        2*(q-s1) + t2-q,
        2*(q-t1) + s2-q,
        ]))
#    print(q, s1, s2, t1, t2)

#    print(S[xi], T[yi]) _ range(Q) range Q q = int(input()) q int(input()) int input() input xi, yi = f_s(q, S), f_s(q, T) xi f_s(q, S) f_s q S yi f_s(q, T) f_s q T s1, s2 = S[xi], S[xi+1] s1 S[xi] S xi s2 S[xi+1] S xi+1 xi 1 t1, t2 = T[yi], T[yi+1] t1 T[yi] T yi t2 T[yi+1] T yi+1 yi 1 print(min([
        max(q-s1,q-t1),
        max(s2-q, t2-q),
        2*(s2-q) + q-t1,
        2*(t2-q) + q-s1,
        2*(q-s1) + t2-q,
        2*(q-t1) + s2-q,
        ])) print min([
        max(q-s1,q-t1),
        max(s2-q, t2-q),
        2*(s2-q) + q-t1,
        2*(t2-q) + q-s1,
        2*(q-s1) + t2-q,
        2*(q-t1) + s2-q,
        ]) min [
        max(q-s1,q-t1),
        max(s2-q, t2-q),
        2*(s2-q) + q-t1,
        2*(t2-q) + q-s1,
        2*(q-s1) + t2-q,
        2*(q-t1) + s2-q,
        ] max(q-s1,q-t1) max q-s1 q s1 q-t1 q t1 max(s2-q, t2-q) max s2-q s2 q t2-q t2 q 2*(s2-q) + q-t1 2*(s2-q) + q 2*(s2-q) 2 s2-q s2 q q t1 2*(t2-q) + q-s1 2*(t2-q) + q 2*(t2-q) 2 t2-q t2 q q s1 2*(q-s1) + t2-q 2*(q-s1) + t2 2*(q-s1) 2 q-s1 q s1 t2 q 2*(q-t1) + s2-q 2*(q-t1) + s2 2*(q-t1) 2 q-t1 q t1 s2 q s1, s2 = S[xi], S[xi+1] S[xi] s1 def f_s(x, l):
    mn, mx = -1, len(l)
    idx = mx//2
    while mx-mn>1:
        if l[idx] < x:
            idx, mn = (idx + mx)//2, idx
            continue
        idx, mx = (idx + mn)//2, idx
    return idx def f_s(x, l):
    mn, mx = -1, len(l)
    idx = mx//2
    while mx-mn>1:
        if l[idx] < x:
            idx, mn = (idx + mx)//2, idx
            continue
        idx, mx = (idx + mn)//2, idx
    return idx f_s Q = map(int, input().split()) map(int, input().split()) Q input = sys.stdin.readline sys.stdin.readline input s2 = S[xi], S[xi+1] S[xi+1] s2 B, Q = map(int, input().split()) map(int, input().split()) B S = [-inf] [-inf] S t2 = T[yi], T[yi+1] T[yi+1] t2 T = [-inf] [-inf] T q = int(input()) int(input()) q xi, yi = f_s(q, S), f_s(q, T) f_s(q, S) xi yi = f_s(q, S), f_s(q, T) f_s(q, T) yi A, B, Q = map(int, input().split()) map(int, input().split()) A t1, t2 = T[yi], T[yi+1] T[yi] t1 inf = 10**18 10**18 inf
import sys
input = sys.stdin.readline
A, B, Q = map(int, input().split())
inf = 10**18
S = [-inf]
for _ in range(A):
    S.append(int(input()))
S.append(inf)
T = [-inf]
for _ in range(B):
    T.append(int(input()))
T.append(inf)
def f_s(x, l):
    mn, mx = -1, len(l)
    idx = mx//2
    while mx-mn>1:
        if l[idx] < x:
            idx, mn = (idx + mx)//2, idx
            continue
        idx, mx = (idx + mn)//2, idx
    return idx

for _ in range(Q):
    q = int(input())
    xi, yi = f_s(q, S), f_s(q, T)
    s1, s2 = S[xi], S[xi+1]
    t1, t2 = T[yi], T[yi+1]
    print(min([
        max(q-s1,q-t1),
        max(s2-q, t2-q),
        2*(s2-q) + q-t1,
        2*(t2-q) + q-s1,
        2*(q-s1) + t2-q,
        2*(q-t1) + s2-q,
        ]))
#    print(q, s1, s2, t1, t2)

#    print(S[xi], T[yi])
