# -*- coding: utf-8 -*-
#D - Lazy Faith
import sys
from bisect import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A, B, Q = map(int, readline().split())
INF = 10**31
S = [-INF]
for _ in range(A):
    s = int(readline())
    S.append(s)
S.append(INF)
T = [-INF]
for _ in range(B):
    t = int(readline())
    T.append(t)
T.append(INF)

for _ in range(Q):
    x = int(readline())
    ind_s = bisect(S,x)
    ind_t = bisect(T,x)
    s1,s2 = S[ind_s-1],S[ind_s]
    t1,t2 = T[ind_t-1],T[ind_t]
    d1 = (x-s1) + (t2-s1) if x-s1 < t2-x else (t2-x) + (t2-s1)
    d2 = (x-t1) + (s2-t1) if x-t1 < s2-x else (s2-x) + (s2-t1)
    d3 = x-s1 if s1 < t1 else x-t1
    d4 = t2-x if s2 < t2 else s2-x
    ans = min(d1,d2,d3,d4)
    print(ans)     import sys sys from bisect import bisect read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines A, B, Q = map(int, readline().split()) A map(int, readline().split()) map int readline().split() ().split () readline split B Q INF = 10**31 INF 10**31 10 31 S = [-INF] S [-INF] -INF INF for _ in range(A):
    s = int(readline())
    S.append(s) _ range(A) range A s = int(readline()) s int(readline()) int readline() readline S.append(s) S.append S append s S.append(INF) S.append S append INF T = [-INF] T [-INF] -INF INF for _ in range(B):
    t = int(readline())
    T.append(t) _ range(B) range B t = int(readline()) t int(readline()) int readline() readline T.append(t) T.append T append t T.append(INF) T.append T append INF for _ in range(Q):
    x = int(readline())
    ind_s = bisect(S,x)
    ind_t = bisect(T,x)
    s1,s2 = S[ind_s-1],S[ind_s]
    t1,t2 = T[ind_t-1],T[ind_t]
    d1 = (x-s1) + (t2-s1) if x-s1 < t2-x else (t2-x) + (t2-s1)
    d2 = (x-t1) + (s2-t1) if x-t1 < s2-x else (s2-x) + (s2-t1)
    d3 = x-s1 if s1 < t1 else x-t1
    d4 = t2-x if s2 < t2 else s2-x
    ans = min(d1,d2,d3,d4)
    print(ans)     _ range(Q) range Q x = int(readline()) x int(readline()) int readline() readline ind_s = bisect(S,x) ind_s bisect(S,x) bisect S x ind_t = bisect(T,x) ind_t bisect(T,x) bisect T x s1,s2 = S[ind_s-1],S[ind_s] s1 S[ind_s-1] S ind_s-1 ind_s 1 s2 S[ind_s] S ind_s t1,t2 = T[ind_t-1],T[ind_t] t1 T[ind_t-1] T ind_t-1 ind_t 1 t2 T[ind_t] T ind_t d1 = (x-s1) + (t2-s1) if x-s1 < t2-x else (t2-x) + (t2-s1) d1 (x-s1) + (t2-s1) if x-s1 < t2-x else (t2-x) + (t2-s1) x-s1 < t2-x x-s1 x s1 t2-x t2 x (x-s1) + (t2-s1) x-s1 x s1 t2-s1 t2 s1 (t2-x) + (t2-s1) t2-x t2 x t2-s1 t2 s1 d2 = (x-t1) + (s2-t1) if x-t1 < s2-x else (s2-x) + (s2-t1) d2 (x-t1) + (s2-t1) if x-t1 < s2-x else (s2-x) + (s2-t1) x-t1 < s2-x x-t1 x t1 s2-x s2 x (x-t1) + (s2-t1) x-t1 x t1 s2-t1 s2 t1 (s2-x) + (s2-t1) s2-x s2 x s2-t1 s2 t1 d3 = x-s1 if s1 < t1 else x-t1 d3 x-s1 if s1 < t1 else x-t1 s1 < t1 s1 t1 x-s1 x s1 x-t1 x t1 d4 = t2-x if s2 < t2 else s2-x d4 t2-x if s2 < t2 else s2-x s2 < t2 s2 t2 t2-x t2 x s2-x s2 x ans = min(d1,d2,d3,d4) ans min(d1,d2,d3,d4) min d1 d2 d3 d4 print(ans) print ans ans = min(d1,d2,d3,d4) min(d1,d2,d3,d4) ans d4 = t2-x if s2 < t2 else s2-x t2-x if s2 < t2 else s2-x d4 d2 = (x-t1) + (s2-t1) if x-t1 < s2-x else (s2-x) + (s2-t1) (x-t1) + (s2-t1) if x-t1 < s2-x else (s2-x) + (s2-t1) d2 x = int(readline()) int(readline()) x t = int(readline()) int(readline()) t readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines T = [-INF] [-INF] T s1,s2 = S[ind_s-1],S[ind_s] S[ind_s-1] s1 readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline t1,t2 = T[ind_t-1],T[ind_t] T[ind_t-1] t1 INF = 10**31 10**31 INF ind_s = bisect(S,x) bisect(S,x) ind_s ind_t = bisect(T,x) bisect(T,x) ind_t d3 = x-s1 if s1 < t1 else x-t1 x-s1 if s1 < t1 else x-t1 d3 Q = map(int, readline().split()) map(int, readline().split()) Q S = [-INF] [-INF] S B, Q = map(int, readline().split()) map(int, readline().split()) B s = int(readline()) int(readline()) s t2 = T[ind_t-1],T[ind_t] T[ind_t] t2 d1 = (x-s1) + (t2-s1) if x-s1 < t2-x else (t2-x) + (t2-s1) (x-s1) + (t2-s1) if x-s1 < t2-x else (t2-x) + (t2-s1) d1 A, B, Q = map(int, readline().split()) map(int, readline().split()) A read = sys.stdin.buffer.read sys.stdin.buffer.read read s2 = S[ind_s-1],S[ind_s] S[ind_s] s2
# -*- coding: utf-8 -*-
#D - Lazy Faith
import sys
from bisect import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A, B, Q = map(int, readline().split())
INF = 10**31
S = [-INF]
for _ in range(A):
    s = int(readline())
    S.append(s)
S.append(INF)
T = [-INF]
for _ in range(B):
    t = int(readline())
    T.append(t)
T.append(INF)

for _ in range(Q):
    x = int(readline())
    ind_s = bisect(S,x)
    ind_t = bisect(T,x)
    s1,s2 = S[ind_s-1],S[ind_s]
    t1,t2 = T[ind_t-1],T[ind_t]
    d1 = (x-s1) + (t2-s1) if x-s1 < t2-x else (t2-x) + (t2-s1)
    d2 = (x-t1) + (s2-t1) if x-t1 < s2-x else (s2-x) + (s2-t1)
    d3 = x-s1 if s1 < t1 else x-t1
    d4 = t2-x if s2 < t2 else s2-x
    ans = min(d1,d2,d3,d4)
    print(ans)    