import bisect

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

for _ in range(Q):
    x = int(input())
    a = bisect.bisect_left(S,x)
    b = bisect.bisect_left(T,x)
    a1 = float("inf")
    a2 = float("inf")
    b1 = float("inf")
    b2 = float("inf")
    
    if a == 0:
        a2 = S[a] - x
    elif a == A:
        a1 = x - S[a-1]
    else:
        a1 = x - S[a-1]
        a2 = S[a] - x
    if b == 0:
        b2 = T[b] - x
    elif b == B:
        b1 = x - T[b-1]
    else:
        b1 = x - T[b-1]
        b2 = T[b] - x
    
    print(min(max(a1,b1),max(a2,b2), min(a1,b2)*2+max(a1,b2), min(a2,b1)*2+max(a2,b1))) 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 _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input S = [int(input()) for _ in range(A)] S [int(input()) for _ in range(A)] int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input T = [int(input()) for _ in range(B)] T [int(input()) for _ in range(B)] for _ in range(Q):
    x = int(input())
    a = bisect.bisect_left(S,x)
    b = bisect.bisect_left(T,x)
    a1 = float("inf")
    a2 = float("inf")
    b1 = float("inf")
    b2 = float("inf")
    
    if a == 0:
        a2 = S[a] - x
    elif a == A:
        a1 = x - S[a-1]
    else:
        a1 = x - S[a-1]
        a2 = S[a] - x
    if b == 0:
        b2 = T[b] - x
    elif b == B:
        b1 = x - T[b-1]
    else:
        b1 = x - T[b-1]
        b2 = T[b] - x
    
    print(min(max(a1,b1),max(a2,b2), min(a1,b2)*2+max(a1,b2), min(a2,b1)*2+max(a2,b1))) _ range(Q) range Q x = int(input()) x int(input()) int input() input a = bisect.bisect_left(S,x) a bisect.bisect_left(S,x) bisect.bisect_left bisect bisect_left S x b = bisect.bisect_left(T,x) b bisect.bisect_left(T,x) bisect.bisect_left bisect bisect_left T x a1 = float("inf") a1 float("inf") float "inf" a2 = float("inf") a2 float("inf") float "inf" b1 = float("inf") b1 float("inf") float "inf" b2 = float("inf") b2 float("inf") float "inf" if a == 0:
        a2 = S[a] - x
    elif a == A:
        a1 = x - S[a-1]
    else:
        a1 = x - S[a-1]
        a2 = S[a] - x
     a == 0 a 0 a2 = S[a] - x a2 S[a] - x S[a] S a x elif a == A:
        a1 = x - S[a-1]
     a == A a A a1 = x - S[a-1] a1 x - S[a-1] x S[a-1] S a-1 a 1 a1 = x - S[a-1] a1 x - S[a-1] x S[a-1] S a-1 a 1 a2 = S[a] - x a2 S[a] - x S[a] S a x if b == 0:
        b2 = T[b] - x
    elif b == B:
        b1 = x - T[b-1]
    else:
        b1 = x - T[b-1]
        b2 = T[b] - x
    
     b == 0 b 0 b2 = T[b] - x b2 T[b] - x T[b] T b x elif b == B:
        b1 = x - T[b-1]
     b == B b B b1 = x - T[b-1] b1 x - T[b-1] x T[b-1] T b-1 b 1 b1 = x - T[b-1] b1 x - T[b-1] x T[b-1] T b-1 b 1 b2 = T[b] - x b2 T[b] - x T[b] T b x print(min(max(a1,b1),max(a2,b2), min(a1,b2)*2+max(a1,b2), min(a2,b1)*2+max(a2,b1))) print min(max(a1,b1),max(a2,b2), min(a1,b2)*2+max(a1,b2), min(a2,b1)*2+max(a2,b1)) min max(a1,b1) max a1 b1 max(a2,b2) max a2 b2 min(a1,b2)*2+max(a1,b2) min(a1,b2)*2 min(a1,b2) min a1 b2 2 max(a1,b2) max a1 b2 min(a2,b1)*2+max(a2,b1) min(a2,b1)*2 min(a2,b1) min a2 b1 2 max(a2,b1) max a2 b1 a2 = S[a] - x S[a] - x a2 b2 = T[b] - x T[b] - x b2 a1 = float("inf") float("inf") a1 b2 = T[b] - x T[b] - x b2 a2 = S[a] - x S[a] - x a2 B, Q = map(int,input().split()) map(int,input().split()) B a1 = x - S[a-1] x - S[a-1] a1 A, B, Q = map(int,input().split()) map(int,input().split()) A S = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] S a = bisect.bisect_left(S,x) bisect.bisect_left(S,x) a b2 = float("inf") float("inf") b2 x = int(input()) int(input()) x b1 = x - T[b-1] x - T[b-1] b1 a2 = float("inf") float("inf") a2 b1 = x - T[b-1] x - T[b-1] b1 Q = map(int,input().split()) map(int,input().split()) Q b1 = float("inf") float("inf") b1 a1 = x - S[a-1] x - S[a-1] a1 T = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] T b = bisect.bisect_left(T,x) bisect.bisect_left(T,x) b
import bisect

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

for _ in range(Q):
    x = int(input())
    a = bisect.bisect_left(S,x)
    b = bisect.bisect_left(T,x)
    a1 = float("inf")
    a2 = float("inf")
    b1 = float("inf")
    b2 = float("inf")
    
    if a == 0:
        a2 = S[a] - x
    elif a == A:
        a1 = x - S[a-1]
    else:
        a1 = x - S[a-1]
        a2 = S[a] - x
    if b == 0:
        b2 = T[b] - x
    elif b == B:
        b1 = x - T[b-1]
    else:
        b1 = x - T[b-1]
        b2 = T[b] - x
    
    print(min(max(a1,b1),max(a2,b2), min(a1,b2)*2+max(a1,b2), min(a2,b1)*2+max(a2,b1)))