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)]
S = sorted(S)
T = sorted(T)

for j in range(Q):
    x = int(input())
    a = S[bisect.bisect_left(S, x)-1]
    b = T[bisect.bisect_left(T, x)-1]
    if x <=S[-1]:
        a_ = S[bisect.bisect_right(S,x)]
    else:
        a_ = S[bisect.bisect_right(S,x)-1]
    if x <= T[-1]:
        b_ = T[bisect.bisect_right(T,x)]
    else:
        b_ = T[bisect.bisect_right(T,x)-1]
    y = min([abs(a-x)+abs(b-a),abs(a-x)+abs(b_-a),abs(a_-x)+abs(b-a_),abs(a_-x)+abs(b_-a_),
            abs(b-x)+abs(a-b),abs(b-x)+abs(a_-b), abs(b_-x)+abs(a-b_), abs(b_-x)+abs(b_-a_)])
    print(y) import bisect 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)] S = sorted(S) S sorted(S) sorted S T = sorted(T) T sorted(T) sorted T for j in range(Q):
    x = int(input())
    a = S[bisect.bisect_left(S, x)-1]
    b = T[bisect.bisect_left(T, x)-1]
    if x <=S[-1]:
        a_ = S[bisect.bisect_right(S,x)]
    else:
        a_ = S[bisect.bisect_right(S,x)-1]
    if x <= T[-1]:
        b_ = T[bisect.bisect_right(T,x)]
    else:
        b_ = T[bisect.bisect_right(T,x)-1]
    y = min([abs(a-x)+abs(b-a),abs(a-x)+abs(b_-a),abs(a_-x)+abs(b-a_),abs(a_-x)+abs(b_-a_),
            abs(b-x)+abs(a-b),abs(b-x)+abs(a_-b), abs(b_-x)+abs(a-b_), abs(b_-x)+abs(b_-a_)])
    print(y) j range(Q) range Q x = int(input()) x int(input()) int input() input a = S[bisect.bisect_left(S, x)-1] a S[bisect.bisect_left(S, x)-1] S bisect.bisect_left(S, x)-1 bisect.bisect_left(S, x) bisect.bisect_left bisect bisect_left S x 1 b = T[bisect.bisect_left(T, x)-1] b T[bisect.bisect_left(T, x)-1] T bisect.bisect_left(T, x)-1 bisect.bisect_left(T, x) bisect.bisect_left bisect bisect_left T x 1 if x <=S[-1]:
        a_ = S[bisect.bisect_right(S,x)]
    else:
        a_ = S[bisect.bisect_right(S,x)-1]
     x <=S[-1] x S[-1] S -1 a_ = S[bisect.bisect_right(S,x)] a_ S[bisect.bisect_right(S,x)] S bisect.bisect_right(S,x) bisect.bisect_right bisect bisect_right S x a_ = S[bisect.bisect_right(S,x)-1] a_ S[bisect.bisect_right(S,x)-1] S bisect.bisect_right(S,x)-1 bisect.bisect_right(S,x) bisect.bisect_right bisect bisect_right S x 1 if x <= T[-1]:
        b_ = T[bisect.bisect_right(T,x)]
    else:
        b_ = T[bisect.bisect_right(T,x)-1]
     x <= T[-1] x T[-1] T -1 b_ = T[bisect.bisect_right(T,x)] b_ T[bisect.bisect_right(T,x)] T bisect.bisect_right(T,x) bisect.bisect_right bisect bisect_right T x b_ = T[bisect.bisect_right(T,x)-1] b_ T[bisect.bisect_right(T,x)-1] T bisect.bisect_right(T,x)-1 bisect.bisect_right(T,x) bisect.bisect_right bisect bisect_right T x 1 y = min([abs(a-x)+abs(b-a),abs(a-x)+abs(b_-a),abs(a_-x)+abs(b-a_),abs(a_-x)+abs(b_-a_),
            abs(b-x)+abs(a-b),abs(b-x)+abs(a_-b), abs(b_-x)+abs(a-b_), abs(b_-x)+abs(b_-a_)]) y min([abs(a-x)+abs(b-a),abs(a-x)+abs(b_-a),abs(a_-x)+abs(b-a_),abs(a_-x)+abs(b_-a_),
            abs(b-x)+abs(a-b),abs(b-x)+abs(a_-b), abs(b_-x)+abs(a-b_), abs(b_-x)+abs(b_-a_)]) min [abs(a-x)+abs(b-a),abs(a-x)+abs(b_-a),abs(a_-x)+abs(b-a_),abs(a_-x)+abs(b_-a_),
            abs(b-x)+abs(a-b),abs(b-x)+abs(a_-b), abs(b_-x)+abs(a-b_), abs(b_-x)+abs(b_-a_)] abs(a-x)+abs(b-a) abs(a-x) abs a-x a x abs(b-a) abs b-a b a abs(a-x)+abs(b_-a) abs(a-x) abs a-x a x abs(b_-a) abs b_-a b_ a abs(a_-x)+abs(b-a_) abs(a_-x) abs a_-x a_ x abs(b-a_) abs b-a_ b a_ abs(a_-x)+abs(b_-a_) abs(a_-x) abs a_-x a_ x abs(b_-a_) abs b_-a_ b_ a_ abs(b-x)+abs(a-b) abs(b-x) abs b-x b x abs(a-b) abs a-b a b abs(b-x)+abs(a_-b) abs(b-x) abs b-x b x abs(a_-b) abs a_-b a_ b abs(b_-x)+abs(a-b_) abs(b_-x) abs b_-x b_ x abs(a-b_) abs a-b_ a b_ abs(b_-x)+abs(b_-a_) abs(b_-x) abs b_-x b_ x abs(b_-a_) abs b_-a_ b_ a_ print(y) print y B,Q = map(int, input().split()) map(int, input().split()) B S = sorted(S) sorted(S) S y = min([abs(a-x)+abs(b-a),abs(a-x)+abs(b_-a),abs(a_-x)+abs(b-a_),abs(a_-x)+abs(b_-a_),
            abs(b-x)+abs(a-b),abs(b-x)+abs(a_-b), abs(b_-x)+abs(a-b_), abs(b_-x)+abs(b_-a_)]) min([abs(a-x)+abs(b-a),abs(a-x)+abs(b_-a),abs(a_-x)+abs(b-a_),abs(a_-x)+abs(b_-a_),
            abs(b-x)+abs(a-b),abs(b-x)+abs(a_-b), abs(b_-x)+abs(a-b_), abs(b_-x)+abs(b_-a_)]) y a_ = S[bisect.bisect_right(S,x)] S[bisect.bisect_right(S,x)] a_ A,B,Q = map(int, input().split()) map(int, input().split()) A b_ = T[bisect.bisect_right(T,x)] T[bisect.bisect_right(T,x)] b_ S = [int(input()) for i in range(A)] [int(input()) for i in range(A)] S T = [int(input()) for i in range(B)] [int(input()) for i in range(B)] T T = sorted(T) sorted(T) T a = S[bisect.bisect_left(S, x)-1] S[bisect.bisect_left(S, x)-1] a b = T[bisect.bisect_left(T, x)-1] T[bisect.bisect_left(T, x)-1] b a_ = S[bisect.bisect_right(S,x)-1] S[bisect.bisect_right(S,x)-1] a_ Q = map(int, input().split()) map(int, input().split()) Q b_ = T[bisect.bisect_right(T,x)-1] T[bisect.bisect_right(T,x)-1] b_ x = int(input()) int(input()) x
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)]
S = sorted(S)
T = sorted(T)

for j in range(Q):
    x = int(input())
    a = S[bisect.bisect_left(S, x)-1]
    b = T[bisect.bisect_left(T, x)-1]
    if x <=S[-1]:
        a_ = S[bisect.bisect_right(S,x)]
    else:
        a_ = S[bisect.bisect_right(S,x)-1]
    if x <= T[-1]:
        b_ = T[bisect.bisect_right(T,x)]
    else:
        b_ = T[bisect.bisect_right(T,x)-1]
    y = min([abs(a-x)+abs(b-a),abs(a-x)+abs(b_-a),abs(a_-x)+abs(b-a_),abs(a_-x)+abs(b_-a_),
            abs(b-x)+abs(a-b),abs(b-x)+abs(a_-b), abs(b_-x)+abs(a-b_), abs(b_-x)+abs(b_-a_)])
    print(y)