# https://atcoder.jp/contests/abc119/tasks/abc119_d
# 

from bisect import bisect_left,bisect_right
A,B,Q=map(int,input().split())
s= [int(input()) for _ in range(A)]
t= [int(input()) for _ in range(B)]
#print(s)
#print(t)
for i in range(Q):
    x=int(input())
    #print(bisect_left(s,x),bisect_left(t,x))
    sl=float("-inf")
    sr=float("inf")
    tl=float("-inf")
    tr=float("inf")
    a=bisect_left(s,x)
    if a>0:
        sl = s[a-1]
    if a<=A-1:
        sr = s[a]
    b=bisect_left(t,x)
    if b>0:
        tl = t[b-1]
    if b<=B-1:
        tr = t[b]
    #print(sl,sr)
    #print(tl,tr)
    
    pat_LL = x - min(sl,tl)
    pat_LR = sr-tl + min(sr-x,x-tl)
    pat_RL = tr-sl + min(tr-x,x-sl)
    pat_RR = max(sr,tr)-x
    
    print(min(pat_LL,pat_LR,pat_RL,pat_RR)) from bisect import bisect_left,bisect_right 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 i in range(Q):
    x=int(input())
    #print(bisect_left(s,x),bisect_left(t,x))
    sl=float("-inf")
    sr=float("inf")
    tl=float("-inf")
    tr=float("inf")
    a=bisect_left(s,x)
    if a>0:
        sl = s[a-1]
    if a<=A-1:
        sr = s[a]
    b=bisect_left(t,x)
    if b>0:
        tl = t[b-1]
    if b<=B-1:
        tr = t[b]
    #print(sl,sr)
    #print(tl,tr)
    
    pat_LL = x - min(sl,tl)
    pat_LR = sr-tl + min(sr-x,x-tl)
    pat_RL = tr-sl + min(tr-x,x-sl)
    pat_RR = max(sr,tr)-x
    
    print(min(pat_LL,pat_LR,pat_RL,pat_RR)) i range(Q) range Q x=int(input()) x int(input()) int input() input sl=float("-inf") sl float("-inf") float "-inf" sr=float("inf") sr float("inf") float "inf" tl=float("-inf") tl float("-inf") float "-inf" tr=float("inf") tr float("inf") float "inf" a=bisect_left(s,x) a bisect_left(s,x) bisect_left s x if a>0:
        sl = s[a-1]
     a>0 a 0 sl = s[a-1] sl s[a-1] s a-1 a 1 if a<=A-1:
        sr = s[a]
     a<=A-1 a A-1 A 1 sr = s[a] sr s[a] s a b=bisect_left(t,x) b bisect_left(t,x) bisect_left t x if b>0:
        tl = t[b-1]
     b>0 b 0 tl = t[b-1] tl t[b-1] t b-1 b 1 if b<=B-1:
        tr = t[b]
    #print(sl,sr)
    #print(tl,tr)
    
     b<=B-1 b B-1 B 1 tr = t[b] tr t[b] t b pat_LL = x - min(sl,tl) pat_LL x - min(sl,tl) x min(sl,tl) min sl tl pat_LR = sr-tl + min(sr-x,x-tl) pat_LR sr-tl + min(sr-x,x-tl) sr-tl sr tl min(sr-x,x-tl) min sr-x sr x x-tl x tl pat_RL = tr-sl + min(tr-x,x-sl) pat_RL tr-sl + min(tr-x,x-sl) tr-sl tr sl min(tr-x,x-sl) min tr-x tr x x-sl x sl pat_RR = max(sr,tr)-x pat_RR max(sr,tr)-x max(sr,tr) max sr tr x print(min(pat_LL,pat_LR,pat_RL,pat_RR)) print min(pat_LL,pat_LR,pat_RL,pat_RR) min pat_LL pat_LR pat_RL pat_RR sr=float("inf") float("inf") sr pat_RR = max(sr,tr)-x max(sr,tr)-x pat_RR B,Q=map(int,input().split()) map(int,input().split()) B t= [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] t tl=float("-inf") float("-inf") tl pat_LR = sr-tl + min(sr-x,x-tl) sr-tl + min(sr-x,x-tl) pat_LR a=bisect_left(s,x) bisect_left(s,x) a tl = t[b-1] t[b-1] tl x=int(input()) int(input()) x pat_RL = tr-sl + min(tr-x,x-sl) tr-sl + min(tr-x,x-sl) pat_RL pat_LL = x - min(sl,tl) x - min(sl,tl) pat_LL tr=float("inf") float("inf") tr A,B,Q=map(int,input().split()) map(int,input().split()) A Q=map(int,input().split()) map(int,input().split()) Q s= [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] s sl = s[a-1] s[a-1] sl sl=float("-inf") float("-inf") sl sr = s[a] s[a] sr b=bisect_left(t,x) bisect_left(t,x) b tr = t[b] t[b] tr
# https://atcoder.jp/contests/abc119/tasks/abc119_d
# 

from bisect import bisect_left,bisect_right
A,B,Q=map(int,input().split())
s= [int(input()) for _ in range(A)]
t= [int(input()) for _ in range(B)]
#print(s)
#print(t)
for i in range(Q):
    x=int(input())
    #print(bisect_left(s,x),bisect_left(t,x))
    sl=float("-inf")
    sr=float("inf")
    tl=float("-inf")
    tr=float("inf")
    a=bisect_left(s,x)
    if a>0:
        sl = s[a-1]
    if a<=A-1:
        sr = s[a]
    b=bisect_left(t,x)
    if b>0:
        tl = t[b-1]
    if b<=B-1:
        tr = t[b]
    #print(sl,sr)
    #print(tl,tr)
    
    pat_LL = x - min(sl,tl)
    pat_LR = sr-tl + min(sr-x,x-tl)
    pat_RL = tr-sl + min(tr-x,x-sl)
    pat_RR = max(sr,tr)-x
    
    print(min(pat_LL,pat_LR,pat_RL,pat_RR))