#template
def inputlist(): return [int(k) for k in input().split()]
def intinput(): return int(input())
#template
A,B,Q = inputlist()
s = [0]*A
t = [0]*B
x = [0]*Q
for i in range(A):
    s[i] = intinput()
for i in range(B):
    t[i] = int(input())
for i in range(Q):
    x[i] = intinput()
s.sort()
t.sort()
ans = [0]*Q
from bisect import bisect_left
for i in range(Q):
    xa = x[i]
    s0,s1 = -1,10**18+1
    t0,t1 = -1,10**18+1
    index_s = bisect_left(s,xa)
    index_t = bisect_left(t,xa)
    if index_s == 0:
        s1 = s[0]
    if index_t == 0:
        t1 = t[0]
    if index_s == A:
        s0 = s[-1]
    if index_t == B:
        t0 = t[-1]
    if index_s != 0 and index_s != A:
        s0 = s[index_s-1]
        s1 = s[index_s]
    if index_t != 0 and index_t != B:
        t0 = t[index_t-1]
        t1 = t[index_t]
    if s0 == -1 or t1 == 10**18+1:
        d1 = 10**18+1
        d2 = 10**18+1
    if s0 != -1 and t1 != 10**18+1:
        d1 = (xa-s0)*2+(t1-xa)
        d2 = (t1-xa)*2+(xa-s0)
    if t0 == -1 or s1 == 10**18+1:
        d3 = 10**18+1
        d4 = 10**18+1
    if t0 != -1 and s1 != 10**18+1:
        d3 = (xa-t0)*2+(s1-xa)
        d4 = (s1-xa)*2+(xa-t0)
    m1 = min(s0,t0)
    M1 = max(s1,t1)
    if m1 == -1:
        d5 = 10**18+1
    if m1 != -1:
        d5 = abs(xa-m1)
    if M1 == 10**18+1:
        d6 = 10**18+1
    if M1 != 10**18+1:
        d6 = abs(xa-M1)
    ans[i] = min(d1,d2,d3,d4,d5,d6)
for i in range(Q):
    print(ans[i]) int(k) for k in input().split() for k in input().split() k input().split() ().split () input split for k in input().split() int(k) int k def inputlist(): return [int(k) for k in input().split()] inputlist def intinput(): return int(input())
#template intinput A,B,Q = inputlist() A inputlist() inputlist B Q s = [0]*A s [0]*A [0] 0 A t = [0]*B t [0]*B [0] 0 B x = [0]*Q x [0]*Q [0] 0 Q for i in range(A):
    s[i] = intinput() i range(A) range A s[i] = intinput() s[i] s i intinput() intinput for i in range(B):
    t[i] = int(input()) i range(B) range B t[i] = int(input()) t[i] t i int(input()) int input() input for i in range(Q):
    x[i] = intinput() i range(Q) range Q x[i] = intinput() x[i] x i intinput() intinput s.sort() s.sort s sort t.sort() t.sort t sort ans = [0]*Q ans [0]*Q [0] 0 Q from bisect import bisect_left for i in range(Q):
    xa = x[i]
    s0,s1 = -1,10**18+1
    t0,t1 = -1,10**18+1
    index_s = bisect_left(s,xa)
    index_t = bisect_left(t,xa)
    if index_s == 0:
        s1 = s[0]
    if index_t == 0:
        t1 = t[0]
    if index_s == A:
        s0 = s[-1]
    if index_t == B:
        t0 = t[-1]
    if index_s != 0 and index_s != A:
        s0 = s[index_s-1]
        s1 = s[index_s]
    if index_t != 0 and index_t != B:
        t0 = t[index_t-1]
        t1 = t[index_t]
    if s0 == -1 or t1 == 10**18+1:
        d1 = 10**18+1
        d2 = 10**18+1
    if s0 != -1 and t1 != 10**18+1:
        d1 = (xa-s0)*2+(t1-xa)
        d2 = (t1-xa)*2+(xa-s0)
    if t0 == -1 or s1 == 10**18+1:
        d3 = 10**18+1
        d4 = 10**18+1
    if t0 != -1 and s1 != 10**18+1:
        d3 = (xa-t0)*2+(s1-xa)
        d4 = (s1-xa)*2+(xa-t0)
    m1 = min(s0,t0)
    M1 = max(s1,t1)
    if m1 == -1:
        d5 = 10**18+1
    if m1 != -1:
        d5 = abs(xa-m1)
    if M1 == 10**18+1:
        d6 = 10**18+1
    if M1 != 10**18+1:
        d6 = abs(xa-M1)
    ans[i] = min(d1,d2,d3,d4,d5,d6) i range(Q) range Q xa = x[i] xa x[i] x i s0,s1 = -1,10**18+1 s0 -1 s1 10**18+1 10**18 10 18 1 t0,t1 = -1,10**18+1 t0 -1 t1 10**18+1 10**18 10 18 1 index_s = bisect_left(s,xa) index_s bisect_left(s,xa) bisect_left s xa index_t = bisect_left(t,xa) index_t bisect_left(t,xa) bisect_left t xa if index_s == 0:
        s1 = s[0]
     index_s == 0 index_s 0 s1 = s[0] s1 s[0] s 0 if index_t == 0:
        t1 = t[0]
     index_t == 0 index_t 0 t1 = t[0] t1 t[0] t 0 if index_s == A:
        s0 = s[-1]
     index_s == A index_s A s0 = s[-1] s0 s[-1] s -1 if index_t == B:
        t0 = t[-1]
     index_t == B index_t B t0 = t[-1] t0 t[-1] t -1 if index_s != 0 and index_s != A:
        s0 = s[index_s-1]
        s1 = s[index_s]
     index_s != 0 and index_s != A index_s != 0 index_s 0 index_s != A index_s A s0 = s[index_s-1] s0 s[index_s-1] s index_s-1 index_s 1 s1 = s[index_s] s1 s[index_s] s index_s if index_t != 0 and index_t != B:
        t0 = t[index_t-1]
        t1 = t[index_t]
     index_t != 0 and index_t != B index_t != 0 index_t 0 index_t != B index_t B t0 = t[index_t-1] t0 t[index_t-1] t index_t-1 index_t 1 t1 = t[index_t] t1 t[index_t] t index_t if s0 == -1 or t1 == 10**18+1:
        d1 = 10**18+1
        d2 = 10**18+1
     s0 == -1 or t1 == 10**18+1 s0 == -1 s0 -1 t1 == 10**18+1 t1 10**18+1 10**18 10 18 1 d1 = 10**18+1 d1 10**18+1 10**18 10 18 1 d2 = 10**18+1 d2 10**18+1 10**18 10 18 1 if s0 != -1 and t1 != 10**18+1:
        d1 = (xa-s0)*2+(t1-xa)
        d2 = (t1-xa)*2+(xa-s0)
     s0 != -1 and t1 != 10**18+1 s0 != -1 s0 -1 t1 != 10**18+1 t1 10**18+1 10**18 10 18 1 d1 = (xa-s0)*2+(t1-xa) d1 (xa-s0)*2+(t1-xa) (xa-s0)*2 xa-s0 xa s0 2 t1-xa t1 xa d2 = (t1-xa)*2+(xa-s0) d2 (t1-xa)*2+(xa-s0) (t1-xa)*2 t1-xa t1 xa 2 xa-s0 xa s0 if t0 == -1 or s1 == 10**18+1:
        d3 = 10**18+1
        d4 = 10**18+1
     t0 == -1 or s1 == 10**18+1 t0 == -1 t0 -1 s1 == 10**18+1 s1 10**18+1 10**18 10 18 1 d3 = 10**18+1 d3 10**18+1 10**18 10 18 1 d4 = 10**18+1 d4 10**18+1 10**18 10 18 1 if t0 != -1 and s1 != 10**18+1:
        d3 = (xa-t0)*2+(s1-xa)
        d4 = (s1-xa)*2+(xa-t0)
     t0 != -1 and s1 != 10**18+1 t0 != -1 t0 -1 s1 != 10**18+1 s1 10**18+1 10**18 10 18 1 d3 = (xa-t0)*2+(s1-xa) d3 (xa-t0)*2+(s1-xa) (xa-t0)*2 xa-t0 xa t0 2 s1-xa s1 xa d4 = (s1-xa)*2+(xa-t0) d4 (s1-xa)*2+(xa-t0) (s1-xa)*2 s1-xa s1 xa 2 xa-t0 xa t0 m1 = min(s0,t0) m1 min(s0,t0) min s0 t0 M1 = max(s1,t1) M1 max(s1,t1) max s1 t1 if m1 == -1:
        d5 = 10**18+1
     m1 == -1 m1 -1 d5 = 10**18+1 d5 10**18+1 10**18 10 18 1 if m1 != -1:
        d5 = abs(xa-m1)
     m1 != -1 m1 -1 d5 = abs(xa-m1) d5 abs(xa-m1) abs xa-m1 xa m1 if M1 == 10**18+1:
        d6 = 10**18+1
     M1 == 10**18+1 M1 10**18+1 10**18 10 18 1 d6 = 10**18+1 d6 10**18+1 10**18 10 18 1 if M1 != 10**18+1:
        d6 = abs(xa-M1)
     M1 != 10**18+1 M1 10**18+1 10**18 10 18 1 d6 = abs(xa-M1) d6 abs(xa-M1) abs xa-M1 xa M1 ans[i] = min(d1,d2,d3,d4,d5,d6) ans[i] ans i min(d1,d2,d3,d4,d5,d6) min d1 d2 d3 d4 d5 d6 for i in range(Q):
    print(ans[i]) i range(Q) range Q print(ans[i]) print ans[i] ans i B,Q = inputlist() inputlist() B s1 = s[0] s[0] s1 Q = inputlist() inputlist() Q m1 = min(s0,t0) min(s0,t0) m1 d6 = abs(xa-M1) abs(xa-M1) d6 index_s = bisect_left(s,xa) bisect_left(s,xa) index_s d6 = 10**18+1 10**18+1 d6 ans = [0]*Q [0]*Q ans t0 = t[index_t-1] t[index_t-1] t0 t1 = t[index_t] t[index_t] t1 x = [0]*Q [0]*Q x index_t = bisect_left(t,xa) bisect_left(t,xa) index_t d1 = 10**18+1 10**18+1 d1 s0 = s[-1] s[-1] s0 xa = x[i] x[i] xa t0,t1 = -1,10**18+1 -1 t0 d2 = 10**18+1 10**18+1 d2 d2 = (t1-xa)*2+(xa-s0) (t1-xa)*2+(xa-s0) d2 A,B,Q = inputlist() inputlist() A d5 = abs(xa-m1) abs(xa-m1) d5 s0 = s[index_s-1] s[index_s-1] s0 d1 = (xa-s0)*2+(t1-xa) (xa-s0)*2+(t1-xa) d1 t = [0]*B [0]*B t t1 = -1,10**18+1 10**18+1 t1 def intinput(): return int(input())
#template def intinput(): return int(input())
#template intinput t0 = t[-1] t[-1] t0 def inputlist(): return [int(k) for k in input().split()] def inputlist(): return [int(k) for k in input().split()] inputlist s1 = -1,10**18+1 10**18+1 s1 d4 = 10**18+1 10**18+1 d4 t1 = t[0] t[0] t1 d3 = (xa-t0)*2+(s1-xa) (xa-t0)*2+(s1-xa) d3 d4 = (s1-xa)*2+(xa-t0) (s1-xa)*2+(xa-t0) d4 s = [0]*A [0]*A s d3 = 10**18+1 10**18+1 d3 s0,s1 = -1,10**18+1 -1 s0 M1 = max(s1,t1) max(s1,t1) M1 d5 = 10**18+1 10**18+1 d5 s1 = s[index_s] s[index_s] s1
#template
def inputlist(): return [int(k) for k in input().split()]
def intinput(): return int(input())
#template
A,B,Q = inputlist()
s = [0]*A
t = [0]*B
x = [0]*Q
for i in range(A):
    s[i] = intinput()
for i in range(B):
    t[i] = int(input())
for i in range(Q):
    x[i] = intinput()
s.sort()
t.sort()
ans = [0]*Q
from bisect import bisect_left
for i in range(Q):
    xa = x[i]
    s0,s1 = -1,10**18+1
    t0,t1 = -1,10**18+1
    index_s = bisect_left(s,xa)
    index_t = bisect_left(t,xa)
    if index_s == 0:
        s1 = s[0]
    if index_t == 0:
        t1 = t[0]
    if index_s == A:
        s0 = s[-1]
    if index_t == B:
        t0 = t[-1]
    if index_s != 0 and index_s != A:
        s0 = s[index_s-1]
        s1 = s[index_s]
    if index_t != 0 and index_t != B:
        t0 = t[index_t-1]
        t1 = t[index_t]
    if s0 == -1 or t1 == 10**18+1:
        d1 = 10**18+1
        d2 = 10**18+1
    if s0 != -1 and t1 != 10**18+1:
        d1 = (xa-s0)*2+(t1-xa)
        d2 = (t1-xa)*2+(xa-s0)
    if t0 == -1 or s1 == 10**18+1:
        d3 = 10**18+1
        d4 = 10**18+1
    if t0 != -1 and s1 != 10**18+1:
        d3 = (xa-t0)*2+(s1-xa)
        d4 = (s1-xa)*2+(xa-t0)
    m1 = min(s0,t0)
    M1 = max(s1,t1)
    if m1 == -1:
        d5 = 10**18+1
    if m1 != -1:
        d5 = abs(xa-m1)
    if M1 == 10**18+1:
        d6 = 10**18+1
    if M1 != 10**18+1:
        d6 = abs(xa-M1)
    ans[i] = min(d1,d2,d3,d4,d5,d6)
for i in range(Q):
    print(ans[i])
