#左右それぞれで一番近い神社
#その神社それぞれの左右それぞれで一番近い寺
#はい２ぶたん

INF = 10**12

from bisect import bisect_right
 
A,B,Q = map(int,input().split())
s = [int(input()) for i in range(A)]
t = [int(input()) for i in range(B)]
ans =[]
for i in range(0,Q,1):
    tmpans = INF

    q = int(input())
    sr = bisect_right(s,q)
    sl = sr-1
    sr = min(sr,A-1)
    sl = max(0,sl)
    for j in (sr,sl):
        tr = bisect_right(t,s[j])
        tl = tr-1
        tr = min(tr,B-1)
        tl = max(0,tl)
        ansR=abs(s[j]-q)+abs(s[j]-t[tr])
        ansL=abs(s[j]-q)+abs(s[j]-t[tl])
        tmpans = min(tmpans,ansR,ansL)

    
    tr = bisect_right(t,q)
    tl = tr-1
    tr = min(tr,B-1)
    tl = max(0,tl)
    for j in (tr,tl):
        sr = bisect_right(s,t[j])
        sl = sr-1
        sr = min(sr,A-1)
        sl = max(0,sl)
        ansR=abs(t[j]-q)+abs(t[j]-s[sr])
        ansL=abs(t[j]-q)+abs(t[j]-s[sl])
        tmpans = min(tmpans,ansR,ansL)
    
    ans.append(tmpans)

for i in range(0,Q,1):
    print(ans[i]) INF = 10**12 INF 10**12 10 12 from bisect import 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 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)] ans =[] ans [] for i in range(0,Q,1):
    tmpans = INF

    q = int(input())
    sr = bisect_right(s,q)
    sl = sr-1
    sr = min(sr,A-1)
    sl = max(0,sl)
    for j in (sr,sl):
        tr = bisect_right(t,s[j])
        tl = tr-1
        tr = min(tr,B-1)
        tl = max(0,tl)
        ansR=abs(s[j]-q)+abs(s[j]-t[tr])
        ansL=abs(s[j]-q)+abs(s[j]-t[tl])
        tmpans = min(tmpans,ansR,ansL)

    
    tr = bisect_right(t,q)
    tl = tr-1
    tr = min(tr,B-1)
    tl = max(0,tl)
    for j in (tr,tl):
        sr = bisect_right(s,t[j])
        sl = sr-1
        sr = min(sr,A-1)
        sl = max(0,sl)
        ansR=abs(t[j]-q)+abs(t[j]-s[sr])
        ansL=abs(t[j]-q)+abs(t[j]-s[sl])
        tmpans = min(tmpans,ansR,ansL)
    
    ans.append(tmpans) i range(0,Q,1) range 0 Q 1 tmpans = INF tmpans INF q = int(input()) q int(input()) int input() input sr = bisect_right(s,q) sr bisect_right(s,q) bisect_right s q sl = sr-1 sl sr-1 sr 1 sr = min(sr,A-1) sr min(sr,A-1) min sr A-1 A 1 sl = max(0,sl) sl max(0,sl) max 0 sl for j in (sr,sl):
        tr = bisect_right(t,s[j])
        tl = tr-1
        tr = min(tr,B-1)
        tl = max(0,tl)
        ansR=abs(s[j]-q)+abs(s[j]-t[tr])
        ansL=abs(s[j]-q)+abs(s[j]-t[tl])
        tmpans = min(tmpans,ansR,ansL)

    
     j (sr,sl) sr sl tr = bisect_right(t,s[j]) tr bisect_right(t,s[j]) bisect_right t s[j] s j tl = tr-1 tl tr-1 tr 1 tr = min(tr,B-1) tr min(tr,B-1) min tr B-1 B 1 tl = max(0,tl) tl max(0,tl) max 0 tl ansR=abs(s[j]-q)+abs(s[j]-t[tr]) ansR abs(s[j]-q)+abs(s[j]-t[tr]) abs(s[j]-q) abs s[j]-q s[j] s j q abs(s[j]-t[tr]) abs s[j]-t[tr] s[j] s j t[tr] t tr ansL=abs(s[j]-q)+abs(s[j]-t[tl]) ansL abs(s[j]-q)+abs(s[j]-t[tl]) abs(s[j]-q) abs s[j]-q s[j] s j q abs(s[j]-t[tl]) abs s[j]-t[tl] s[j] s j t[tl] t tl tmpans = min(tmpans,ansR,ansL) tmpans min(tmpans,ansR,ansL) min tmpans ansR ansL tr = bisect_right(t,q) tr bisect_right(t,q) bisect_right t q tl = tr-1 tl tr-1 tr 1 tr = min(tr,B-1) tr min(tr,B-1) min tr B-1 B 1 tl = max(0,tl) tl max(0,tl) max 0 tl for j in (tr,tl):
        sr = bisect_right(s,t[j])
        sl = sr-1
        sr = min(sr,A-1)
        sl = max(0,sl)
        ansR=abs(t[j]-q)+abs(t[j]-s[sr])
        ansL=abs(t[j]-q)+abs(t[j]-s[sl])
        tmpans = min(tmpans,ansR,ansL)
    
     j (tr,tl) tr tl sr = bisect_right(s,t[j]) sr bisect_right(s,t[j]) bisect_right s t[j] t j sl = sr-1 sl sr-1 sr 1 sr = min(sr,A-1) sr min(sr,A-1) min sr A-1 A 1 sl = max(0,sl) sl max(0,sl) max 0 sl ansR=abs(t[j]-q)+abs(t[j]-s[sr]) ansR abs(t[j]-q)+abs(t[j]-s[sr]) abs(t[j]-q) abs t[j]-q t[j] t j q abs(t[j]-s[sr]) abs t[j]-s[sr] t[j] t j s[sr] s sr ansL=abs(t[j]-q)+abs(t[j]-s[sl]) ansL abs(t[j]-q)+abs(t[j]-s[sl]) abs(t[j]-q) abs t[j]-q t[j] t j q abs(t[j]-s[sl]) abs t[j]-s[sl] t[j] t j s[sl] s sl tmpans = min(tmpans,ansR,ansL) tmpans min(tmpans,ansR,ansL) min tmpans ansR ansL ans.append(tmpans) ans.append ans append tmpans for i in range(0,Q,1):
    print(ans[i]) i range(0,Q,1) range 0 Q 1 print(ans[i]) print ans[i] ans i tmpans = min(tmpans,ansR,ansL) min(tmpans,ansR,ansL) tmpans tl = max(0,tl) max(0,tl) tl s = [int(input()) for i in range(A)] [int(input()) for i in range(A)] s tmpans = min(tmpans,ansR,ansL) min(tmpans,ansR,ansL) tmpans tr = bisect_right(t,q) bisect_right(t,q) tr B,Q = map(int,input().split()) map(int,input().split()) B sr = min(sr,A-1) min(sr,A-1) sr sr = min(sr,A-1) min(sr,A-1) sr ans =[] [] ans tl = tr-1 tr-1 tl tl = max(0,tl) max(0,tl) tl sr = bisect_right(s,q) bisect_right(s,q) sr sl = max(0,sl) max(0,sl) sl ansL=abs(t[j]-q)+abs(t[j]-s[sl]) abs(t[j]-q)+abs(t[j]-s[sl]) ansL ansR=abs(s[j]-q)+abs(s[j]-t[tr]) abs(s[j]-q)+abs(s[j]-t[tr]) ansR tl = tr-1 tr-1 tl INF = 10**12 10**12 INF tmpans = INF INF tmpans tr = bisect_right(t,s[j]) bisect_right(t,s[j]) tr ansL=abs(s[j]-q)+abs(s[j]-t[tl]) abs(s[j]-q)+abs(s[j]-t[tl]) ansL t = [int(input()) for i in range(B)] [int(input()) for i in range(B)] t Q = map(int,input().split()) map(int,input().split()) Q q = int(input()) int(input()) q tr = min(tr,B-1) min(tr,B-1) tr sl = max(0,sl) max(0,sl) sl sl = sr-1 sr-1 sl tr = min(tr,B-1) min(tr,B-1) tr sr = bisect_right(s,t[j]) bisect_right(s,t[j]) sr sl = sr-1 sr-1 sl A,B,Q = map(int,input().split()) map(int,input().split()) A ansR=abs(t[j]-q)+abs(t[j]-s[sr]) abs(t[j]-q)+abs(t[j]-s[sr]) ansR
#左右それぞれで一番近い神社
#その神社それぞれの左右それぞれで一番近い寺
#はい２ぶたん

INF = 10**12

from bisect import bisect_right
 
A,B,Q = map(int,input().split())
s = [int(input()) for i in range(A)]
t = [int(input()) for i in range(B)]
ans =[]
for i in range(0,Q,1):
    tmpans = INF

    q = int(input())
    sr = bisect_right(s,q)
    sl = sr-1
    sr = min(sr,A-1)
    sl = max(0,sl)
    for j in (sr,sl):
        tr = bisect_right(t,s[j])
        tl = tr-1
        tr = min(tr,B-1)
        tl = max(0,tl)
        ansR=abs(s[j]-q)+abs(s[j]-t[tr])
        ansL=abs(s[j]-q)+abs(s[j]-t[tl])
        tmpans = min(tmpans,ansR,ansL)

    
    tr = bisect_right(t,q)
    tl = tr-1
    tr = min(tr,B-1)
    tl = max(0,tl)
    for j in (tr,tl):
        sr = bisect_right(s,t[j])
        sl = sr-1
        sr = min(sr,A-1)
        sl = max(0,sl)
        ansR=abs(t[j]-q)+abs(t[j]-s[sr])
        ansL=abs(t[j]-q)+abs(t[j]-s[sl])
        tmpans = min(tmpans,ansR,ansL)
    
    ans.append(tmpans)

for i in range(0,Q,1):
    print(ans[i])