import sys
input = sys.stdin.readline
from bisect import bisect

A,B,Q = map(int,input().split())
S = [int(input()) for i in range(A)]
T = [int(input()) for i in range(B)]
X = [int(input()) for i in range(Q)]

INF = float('inf')
st = []
for s in S:
    i = bisect(T,s)
    x0,x1 = -INF,INF
    if i > 0: x0 = T[i-1]
    if i < B: x1 = T[i]
    st.append(min(s-x0, x1-s))
ts = []
for t in T:
    i = bisect(S,t)
    x0,x1 = -INF,INF
    if i > 0: x0 = S[i-1]
    if i < A: x1 = S[i]
    ts.append(min(t-x0, x1-t))

ans = []
for x in X:
    d0 = d1 = d2 = d3 = INF
    si = bisect(S,x)
    if si > 0:
        d0 = x-S[si-1] + st[si-1]
    if si < A:
        d1 = S[si]-x + st[si]
    ti = bisect(T,x)
    if ti > 0:
        d2 = x-T[ti-1] + ts[ti-1]
    if ti < B:
        d3 = T[ti]-x + ts[ti]
    ans.append(min(d0,d1,d2,d3))
print(*ans, sep='\n') import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 int(input()) for i in range(A) for i in range(A) i range(A) range A for i in range(A) int(input()) int input() input S = [int(input()) for i in range(A)] S [int(input()) for i in range(A)] int(input()) for i in range(B) for i in range(B) i range(B) range B for i in range(B) int(input()) int input() input T = [int(input()) for i in range(B)] T [int(input()) for i in range(B)] int(input()) for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) int(input()) int input() input X = [int(input()) for i in range(Q)] X [int(input()) for i in range(Q)] INF = float('inf') INF float('inf') float 'inf' st = [] st [] for s in S:
    i = bisect(T,s)
    x0,x1 = -INF,INF
    if i > 0: x0 = T[i-1]
    if i < B: x1 = T[i]
    st.append(min(s-x0, x1-s)) s S i = bisect(T,s) i bisect(T,s) bisect T s x0,x1 = -INF,INF x0 -INF INF x1 INF if i > 0: x0 = T[i-1]
     i > 0 i 0 if i < B: x1 = T[i]
     i < B i B st.append(min(s-x0, x1-s)) st.append st append min(s-x0, x1-s) min s-x0 s x0 x1-s x1 s ts = [] ts [] for t in T:
    i = bisect(S,t)
    x0,x1 = -INF,INF
    if i > 0: x0 = S[i-1]
    if i < A: x1 = S[i]
    ts.append(min(t-x0, x1-t)) t T i = bisect(S,t) i bisect(S,t) bisect S t x0,x1 = -INF,INF x0 -INF INF x1 INF if i > 0: x0 = S[i-1]
     i > 0 i 0 if i < A: x1 = S[i]
     i < A i A ts.append(min(t-x0, x1-t)) ts.append ts append min(t-x0, x1-t) min t-x0 t x0 x1-t x1 t ans = [] ans [] for x in X:
    d0 = d1 = d2 = d3 = INF
    si = bisect(S,x)
    if si > 0:
        d0 = x-S[si-1] + st[si-1]
    if si < A:
        d1 = S[si]-x + st[si]
    ti = bisect(T,x)
    if ti > 0:
        d2 = x-T[ti-1] + ts[ti-1]
    if ti < B:
        d3 = T[ti]-x + ts[ti]
    ans.append(min(d0,d1,d2,d3)) x X d0 = d1 = d2 = d3 = INF d0 INF = d1 = d2 = d3 = INF d1 INF d2 d3 si = bisect(S,x) si bisect(S,x) bisect S x if si > 0:
        d0 = x-S[si-1] + st[si-1]
     si > 0 si 0 d0 = x-S[si-1] + st[si-1] d0 x-S[si-1] + st[si-1] x-S[si-1] x S[si-1] S si-1 si 1 st[si-1] st si-1 si 1 if si < A:
        d1 = S[si]-x + st[si]
     si < A si A d1 = S[si]-x + st[si] d1 S[si]-x + st[si] S[si]-x S[si] S si x st[si] st si ti = bisect(T,x) ti bisect(T,x) bisect T x if ti > 0:
        d2 = x-T[ti-1] + ts[ti-1]
     ti > 0 ti 0 d2 = x-T[ti-1] + ts[ti-1] d2 x-T[ti-1] + ts[ti-1] x-T[ti-1] x T[ti-1] T ti-1 ti 1 ts[ti-1] ts ti-1 ti 1 if ti < B:
        d3 = T[ti]-x + ts[ti]
     ti < B ti B d3 = T[ti]-x + ts[ti] d3 T[ti]-x + ts[ti] T[ti]-x T[ti] T ti x ts[ti] ts ti ans.append(min(d0,d1,d2,d3)) ans.append ans append min(d0,d1,d2,d3) min d0 d1 d2 d3 print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' X = [int(input()) for i in range(Q)] [int(input()) for i in range(Q)] X x0,x1 = -INF,INF -INF x0 d0 = d1 = d2 = d3 = INF INF d0 x1 = -INF,INF INF x1 i = bisect(S,t) bisect(S,t) i x1 = -INF,INF INF x1 x0,x1 = -INF,INF -INF x0 si = bisect(S,x) bisect(S,x) si S = [int(input()) for i in range(A)] [int(input()) for i in range(A)] S ans = [] [] ans T = [int(input()) for i in range(B)] [int(input()) for i in range(B)] T d0 = x-S[si-1] + st[si-1] x-S[si-1] + st[si-1] d0 ti = bisect(T,x) bisect(T,x) ti d1 = S[si]-x + st[si] S[si]-x + st[si] d1 B,Q = map(int,input().split()) map(int,input().split()) B ts = [] [] ts A,B,Q = map(int,input().split()) map(int,input().split()) A d3 = T[ti]-x + ts[ti] T[ti]-x + ts[ti] d3 d1 = d2 = d3 = INF INF d1 input = sys.stdin.readline sys.stdin.readline input st = [] [] st i = bisect(T,s) bisect(T,s) i d3 = INF INF d3 Q = map(int,input().split()) map(int,input().split()) Q d2 = d3 = INF INF d2 d2 = x-T[ti-1] + ts[ti-1] x-T[ti-1] + ts[ti-1] d2 INF = float('inf') float('inf') INF
import sys
input = sys.stdin.readline
from bisect import bisect

A,B,Q = map(int,input().split())
S = [int(input()) for i in range(A)]
T = [int(input()) for i in range(B)]
X = [int(input()) for i in range(Q)]

INF = float('inf')
st = []
for s in S:
    i = bisect(T,s)
    x0,x1 = -INF,INF
    if i > 0: x0 = T[i-1]
    if i < B: x1 = T[i]
    st.append(min(s-x0, x1-s))
ts = []
for t in T:
    i = bisect(S,t)
    x0,x1 = -INF,INF
    if i > 0: x0 = S[i-1]
    if i < A: x1 = S[i]
    ts.append(min(t-x0, x1-t))

ans = []
for x in X:
    d0 = d1 = d2 = d3 = INF
    si = bisect(S,x)
    if si > 0:
        d0 = x-S[si-1] + st[si-1]
    if si < A:
        d1 = S[si]-x + st[si]
    ti = bisect(T,x)
    if ti > 0:
        d2 = x-T[ti-1] + ts[ti-1]
    if ti < B:
        d3 = T[ti]-x + ts[ti]
    ans.append(min(d0,d1,d2,d3))
print(*ans, sep='\n')