# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
A,B,Q = map(int,input().split())
S = [-float("inf")] + [int(input()) for _ in range(A)] + [float("inf")] # 両端にダミーを追加
T = [-float("inf")] + [int(input()) for _ in range(B)] + [float("inf")] # 両端にダミーを追加
X = [int(input()) for _ in range(Q)]
 
from bisect import bisect_left

for x in X:
    Si,Ti = bisect_left(S,x),bisect_left(T,x)
    Sw,Se = abs(x-S[Si-1]),abs(x-S[Si])
    Tw,Te = abs(x-T[Ti-1]),abs(x-T[Ti])
    ans = [0]*4
    ans[0] = max(Sw,Tw) # 両方ともwest
    ans[1] = max(Se,Te) # 両方ともeast
    ans[2] = 2*min(Sw,Te)+max(Sw,Te) # SwとTeの近い方に行き、反転して行ってない方に行く 
    ans[3] = 2*min(Tw,Se)+max(Tw,Se) # TwとSeの近い方に行き、反転して行ってない方に行く 
    print(min(ans)) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 = [-float("inf")] + [int(input()) for _ in range(A)] + [float("inf")] S [-float("inf")] + [int(input()) for _ in range(A)] + [float("inf")] [-float("inf")] + [int(input()) for _ in range(A)] [-float("inf")] -float("inf") float("inf") float "inf" [int(input()) for _ in range(A)] [float("inf")] float("inf") float "inf" int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input T = [-float("inf")] + [int(input()) for _ in range(B)] + [float("inf")] T [-float("inf")] + [int(input()) for _ in range(B)] + [float("inf")] [-float("inf")] + [int(input()) for _ in range(B)] [-float("inf")] -float("inf") float("inf") float "inf" [int(input()) for _ in range(B)] [float("inf")] float("inf") float "inf" int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input X = [int(input()) for _ in range(Q)] X [int(input()) for _ in range(Q)] from bisect import bisect_left for x in X:
    Si,Ti = bisect_left(S,x),bisect_left(T,x)
    Sw,Se = abs(x-S[Si-1]),abs(x-S[Si])
    Tw,Te = abs(x-T[Ti-1]),abs(x-T[Ti])
    ans = [0]*4
    ans[0] = max(Sw,Tw) # 両方ともwest
    ans[1] = max(Se,Te) # 両方ともeast
    ans[2] = 2*min(Sw,Te)+max(Sw,Te) # SwとTeの近い方に行き、反転して行ってない方に行く 
    ans[3] = 2*min(Tw,Se)+max(Tw,Se) # TwとSeの近い方に行き、反転して行ってない方に行く 
    print(min(ans)) x X Si,Ti = bisect_left(S,x),bisect_left(T,x) Si bisect_left(S,x) bisect_left S x Ti bisect_left(T,x) bisect_left T x Sw,Se = abs(x-S[Si-1]),abs(x-S[Si]) Sw abs(x-S[Si-1]) abs x-S[Si-1] x S[Si-1] S Si-1 Si 1 Se abs(x-S[Si]) abs x-S[Si] x S[Si] S Si Tw,Te = abs(x-T[Ti-1]),abs(x-T[Ti]) Tw abs(x-T[Ti-1]) abs x-T[Ti-1] x T[Ti-1] T Ti-1 Ti 1 Te abs(x-T[Ti]) abs x-T[Ti] x T[Ti] T Ti ans = [0]*4 ans [0]*4 [0] 0 4 ans[0] = max(Sw,Tw) ans[0] ans 0 max(Sw,Tw) max Sw Tw ans[1] = max(Se,Te) ans[1] ans 1 max(Se,Te) max Se Te ans[2] = 2*min(Sw,Te)+max(Sw,Te) ans[2] ans 2 2*min(Sw,Te)+max(Sw,Te) 2*min(Sw,Te) 2 min(Sw,Te) min Sw Te max(Sw,Te) max Sw Te ans[3] = 2*min(Tw,Se)+max(Tw,Se) ans[3] ans 3 2*min(Tw,Se)+max(Tw,Se) 2*min(Tw,Se) 2 min(Tw,Se) min Tw Se max(Tw,Se) max Tw Se print(min(ans)) print min(ans) min ans ans = [0]*4 [0]*4 ans Sw,Se = abs(x-S[Si-1]),abs(x-S[Si]) abs(x-S[Si-1]) Sw Te = abs(x-T[Ti-1]),abs(x-T[Ti]) abs(x-T[Ti]) Te T = [-float("inf")] + [int(input()) for _ in range(B)] + [float("inf")] [-float("inf")] + [int(input()) for _ in range(B)] + [float("inf")] T A,B,Q = map(int,input().split()) map(int,input().split()) A X = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] X Si,Ti = bisect_left(S,x),bisect_left(T,x) bisect_left(S,x) Si Ti = bisect_left(S,x),bisect_left(T,x) bisect_left(T,x) Ti Tw,Te = abs(x-T[Ti-1]),abs(x-T[Ti]) abs(x-T[Ti-1]) Tw Se = abs(x-S[Si-1]),abs(x-S[Si]) abs(x-S[Si]) Se input = sys.stdin.readline sys.stdin.readline input S = [-float("inf")] + [int(input()) for _ in range(A)] + [float("inf")] [-float("inf")] + [int(input()) for _ in range(A)] + [float("inf")] S B,Q = map(int,input().split()) map(int,input().split()) B Q = map(int,input().split()) map(int,input().split()) Q
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
A,B,Q = map(int,input().split())
S = [-float("inf")] + [int(input()) for _ in range(A)] + [float("inf")] # 両端にダミーを追加
T = [-float("inf")] + [int(input()) for _ in range(B)] + [float("inf")] # 両端にダミーを追加
X = [int(input()) for _ in range(Q)]
 
from bisect import bisect_left

for x in X:
    Si,Ti = bisect_left(S,x),bisect_left(T,x)
    Sw,Se = abs(x-S[Si-1]),abs(x-S[Si])
    Tw,Te = abs(x-T[Ti-1]),abs(x-T[Ti])
    ans = [0]*4
    ans[0] = max(Sw,Tw) # 両方ともwest
    ans[1] = max(Se,Te) # 両方ともeast
    ans[2] = 2*min(Sw,Te)+max(Sw,Te) # SwとTeの近い方に行き、反転して行ってない方に行く 
    ans[3] = 2*min(Tw,Se)+max(Tw,Se) # TwとSeの近い方に行き、反転して行ってない方に行く 
    print(min(ans))