from bisect import bisect

A, B, Q = map(int, input().split())
INF = 10 ** 18
S = [-INF]
T = [-INF]
for i in range(A):
    S.append(int(input()))
for i in range(B):
    T.append(int(input()))
S.append(INF)
T.append(INF)
for i in range(Q):
    x = int(input())
    sr = bisect(S, x)
    sl = sr - 1
    tr = bisect(T, x)
    tl = tr - 1
    def d(y): return abs(x - y)
    ans = min(d(max(S[sr], T[tr])), d(min(S[sl], T[tl])))
    ans = min(ans, 2 * d(S[sr]) + d(T[tl]))
    ans = min(ans, d(S[sr]) + 2 * d(T[tl]))
    ans = min(ans, 2 * d(S[sl]) + d(T[tr]))
    ans = min(ans, d(S[sl]) + 2 * d(T[tr]))
    print(ans) from bisect import bisect 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 T = [-INF] T [-INF] -INF INF 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 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 S.append(INF) S.append S append INF T.append(INF) T.append T append INF for i in range(Q):
    x = int(input())
    sr = bisect(S, x)
    sl = sr - 1
    tr = bisect(T, x)
    tl = tr - 1
    def d(y): return abs(x - y)
    ans = min(d(max(S[sr], T[tr])), d(min(S[sl], T[tl])))
    ans = min(ans, 2 * d(S[sr]) + d(T[tl]))
    ans = min(ans, d(S[sr]) + 2 * d(T[tl]))
    ans = min(ans, 2 * d(S[sl]) + d(T[tr]))
    ans = min(ans, d(S[sl]) + 2 * d(T[tr]))
    print(ans) i range(Q) range Q x = int(input()) x int(input()) int input() input sr = bisect(S, x) sr bisect(S, x) bisect S x sl = sr - 1 sl sr - 1 sr 1 tr = bisect(T, x) tr bisect(T, x) bisect T x tl = tr - 1 tl tr - 1 tr 1 def d(y): return abs(x - y)
     d y y ans = min(d(max(S[sr], T[tr])), d(min(S[sl], T[tl]))) ans min(d(max(S[sr], T[tr])), d(min(S[sl], T[tl]))) min d(max(S[sr], T[tr])) d max(S[sr], T[tr]) max S[sr] S sr T[tr] T tr d(min(S[sl], T[tl])) d min(S[sl], T[tl]) min S[sl] S sl T[tl] T tl ans = min(ans, 2 * d(S[sr]) + d(T[tl])) ans min(ans, 2 * d(S[sr]) + d(T[tl])) min ans 2 * d(S[sr]) + d(T[tl]) 2 * d(S[sr]) 2 d(S[sr]) d S[sr] S sr d(T[tl]) d T[tl] T tl ans = min(ans, d(S[sr]) + 2 * d(T[tl])) ans min(ans, d(S[sr]) + 2 * d(T[tl])) min ans d(S[sr]) + 2 * d(T[tl]) d(S[sr]) d S[sr] S sr 2 * d(T[tl]) 2 d(T[tl]) d T[tl] T tl ans = min(ans, 2 * d(S[sl]) + d(T[tr])) ans min(ans, 2 * d(S[sl]) + d(T[tr])) min ans 2 * d(S[sl]) + d(T[tr]) 2 * d(S[sl]) 2 d(S[sl]) d S[sl] S sl d(T[tr]) d T[tr] T tr ans = min(ans, d(S[sl]) + 2 * d(T[tr])) ans min(ans, d(S[sl]) + 2 * d(T[tr])) min ans d(S[sl]) + 2 * d(T[tr]) d(S[sl]) d S[sl] S sl 2 * d(T[tr]) 2 d(T[tr]) d T[tr] T tr print(ans) print ans def d(y): return abs(x - y)
     def d(y): return abs(x - y)
     d ans = min(ans, d(S[sl]) + 2 * d(T[tr])) min(ans, d(S[sl]) + 2 * d(T[tr])) ans INF = 10 ** 18 10 ** 18 INF A, B, Q = map(int, input().split()) map(int, input().split()) A x = int(input()) int(input()) x tr = bisect(T, x) bisect(T, x) tr tl = tr - 1 tr - 1 tl S = [-INF] [-INF] S ans = min(ans, 2 * d(S[sl]) + d(T[tr])) min(ans, 2 * d(S[sl]) + d(T[tr])) ans B, Q = map(int, input().split()) map(int, input().split()) B ans = min(ans, d(S[sr]) + 2 * d(T[tl])) min(ans, d(S[sr]) + 2 * d(T[tl])) ans sl = sr - 1 sr - 1 sl ans = min(ans, 2 * d(S[sr]) + d(T[tl])) min(ans, 2 * d(S[sr]) + d(T[tl])) ans Q = map(int, input().split()) map(int, input().split()) Q ans = min(d(max(S[sr], T[tr])), d(min(S[sl], T[tl]))) min(d(max(S[sr], T[tr])), d(min(S[sl], T[tl]))) ans T = [-INF] [-INF] T sr = bisect(S, x) bisect(S, x) sr
from bisect import bisect

A, B, Q = map(int, input().split())
INF = 10 ** 18
S = [-INF]
T = [-INF]
for i in range(A):
    S.append(int(input()))
for i in range(B):
    T.append(int(input()))
S.append(INF)
T.append(INF)
for i in range(Q):
    x = int(input())
    sr = bisect(S, x)
    sl = sr - 1
    tr = bisect(T, x)
    tl = tr - 1
    def d(y): return abs(x - y)
    ans = min(d(max(S[sr], T[tr])), d(min(S[sl], T[tl])))
    ans = min(ans, 2 * d(S[sr]) + d(T[tl]))
    ans = min(ans, d(S[sr]) + 2 * d(T[tl]))
    ans = min(ans, 2 * d(S[sl]) + d(T[tr]))
    ans = min(ans, d(S[sl]) + 2 * d(T[tr]))
    print(ans)
