import bisect,sys 
input=sys.stdin.readline 
a,b,Q=map(int,input().split())
INF=10**18
s=[-INF]+[int(input()) for _ in range(a)]+[INF]
t=[-INF]+[int(input()) for _ in range(b)]+[INF]
for q in range(Q):
    x=int(input())
    b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x)
    res=INF 
    for S in [s[b-1],s[b]]:
        for T in [t[d-1],t[d]]:
            d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S)
            res=min(res,d1,d2)
    print(res) import bisect,sys bisect 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 INF=10**18 INF 10**18 10 18 int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input s=[-INF]+[int(input()) for _ in range(a)]+[INF] s [-INF]+[int(input()) for _ in range(a)]+[INF] [-INF]+[int(input()) for _ in range(a)] [-INF] -INF INF [int(input()) for _ in range(a)] [INF] 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=[-INF]+[int(input()) for _ in range(b)]+[INF] t [-INF]+[int(input()) for _ in range(b)]+[INF] [-INF]+[int(input()) for _ in range(b)] [-INF] -INF INF [int(input()) for _ in range(b)] [INF] INF for q in range(Q):
    x=int(input())
    b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x)
    res=INF 
    for S in [s[b-1],s[b]]:
        for T in [t[d-1],t[d]]:
            d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S)
            res=min(res,d1,d2)
    print(res) q range(Q) range Q x=int(input()) x int(input()) int input() input b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x) b bisect.bisect_right(s,x) bisect.bisect_right bisect bisect_right s x d bisect.bisect_right(t,x) bisect.bisect_right bisect bisect_right t x res=INF res INF for S in [s[b-1],s[b]]:
        for T in [t[d-1],t[d]]:
            d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S)
            res=min(res,d1,d2)
     S [s[b-1],s[b]] s[b-1] s b-1 b 1 s[b] s b for T in [t[d-1],t[d]]:
            d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S)
            res=min(res,d1,d2)
     T [t[d-1],t[d]] t[d-1] t d-1 d 1 t[d] t d d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S) d1 abs(S-x)+abs(T-S) abs(S-x) abs S-x S x abs(T-S) abs T-S T S d2 abs(T-x)+abs(T-S) abs(T-x) abs T-x T x abs(T-S) abs T-S T S res=min(res,d1,d2) res min(res,d1,d2) min res d1 d2 print(res) print res res=min(res,d1,d2) min(res,d1,d2) res b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x) bisect.bisect_right(s,x) b res=INF INF res input=sys.stdin.readline sys.stdin.readline input b,Q=map(int,input().split()) map(int,input().split()) b INF=10**18 10**18 INF s=[-INF]+[int(input()) for _ in range(a)]+[INF] [-INF]+[int(input()) for _ in range(a)]+[INF] s x=int(input()) int(input()) x a,b,Q=map(int,input().split()) map(int,input().split()) a Q=map(int,input().split()) map(int,input().split()) Q t=[-INF]+[int(input()) for _ in range(b)]+[INF] [-INF]+[int(input()) for _ in range(b)]+[INF] t d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S) abs(S-x)+abs(T-S) d1 d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S) abs(T-x)+abs(T-S) d2 d=bisect.bisect_right(s,x),bisect.bisect_right(t,x) bisect.bisect_right(t,x) d
import bisect,sys 
input=sys.stdin.readline 
a,b,Q=map(int,input().split())
INF=10**18
s=[-INF]+[int(input()) for _ in range(a)]+[INF]
t=[-INF]+[int(input()) for _ in range(b)]+[INF]
for q in range(Q):
    x=int(input())
    b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x)
    res=INF 
    for S in [s[b-1],s[b]]:
        for T in [t[d-1],t[d]]:
            d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S)
            res=min(res,d1,d2)
    print(res)