import bisect

inf = 10**18

a,b,q = map(int,input().split())
s = [-inf]+[int(input()) for _ in range(a)]+[inf]
t = [-inf]+[int(input()) for _ in range(b)]+[inf]
x = [int(input()) for _ in range(q)]

for i in x:
    a1 = s[bisect.bisect_right(s,i)]
    b1 = t[bisect.bisect_right(t,i)]
    a2 = s[bisect.bisect_right(s,i)-1]
    b2 = t[bisect.bisect_right(t,i)-1]
    ans = inf
    for j in [a1,a2]:
        for k in [b1,b2]:
            ans = min(ans,abs(i-j)+abs(j-k),abs(i-k)+abs(k-j))
    print(ans) import bisect bisect inf = 10**18 inf 10**18 10 18 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 = [-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 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)] for i in x:
    a1 = s[bisect.bisect_right(s,i)]
    b1 = t[bisect.bisect_right(t,i)]
    a2 = s[bisect.bisect_right(s,i)-1]
    b2 = t[bisect.bisect_right(t,i)-1]
    ans = inf
    for j in [a1,a2]:
        for k in [b1,b2]:
            ans = min(ans,abs(i-j)+abs(j-k),abs(i-k)+abs(k-j))
    print(ans) i x a1 = s[bisect.bisect_right(s,i)] a1 s[bisect.bisect_right(s,i)] s bisect.bisect_right(s,i) bisect.bisect_right bisect bisect_right s i b1 = t[bisect.bisect_right(t,i)] b1 t[bisect.bisect_right(t,i)] t bisect.bisect_right(t,i) bisect.bisect_right bisect bisect_right t i a2 = s[bisect.bisect_right(s,i)-1] a2 s[bisect.bisect_right(s,i)-1] s bisect.bisect_right(s,i)-1 bisect.bisect_right(s,i) bisect.bisect_right bisect bisect_right s i 1 b2 = t[bisect.bisect_right(t,i)-1] b2 t[bisect.bisect_right(t,i)-1] t bisect.bisect_right(t,i)-1 bisect.bisect_right(t,i) bisect.bisect_right bisect bisect_right t i 1 ans = inf ans inf for j in [a1,a2]:
        for k in [b1,b2]:
            ans = min(ans,abs(i-j)+abs(j-k),abs(i-k)+abs(k-j))
     j [a1,a2] a1 a2 for k in [b1,b2]:
            ans = min(ans,abs(i-j)+abs(j-k),abs(i-k)+abs(k-j))
     k [b1,b2] b1 b2 ans = min(ans,abs(i-j)+abs(j-k),abs(i-k)+abs(k-j)) ans min(ans,abs(i-j)+abs(j-k),abs(i-k)+abs(k-j)) min ans abs(i-j)+abs(j-k) abs(i-j) abs i-j i j abs(j-k) abs j-k j k abs(i-k)+abs(k-j) abs(i-k) abs i-k i k abs(k-j) abs k-j k j print(ans) print ans a2 = s[bisect.bisect_right(s,i)-1] s[bisect.bisect_right(s,i)-1] a2 ans = inf inf ans b1 = t[bisect.bisect_right(t,i)] t[bisect.bisect_right(t,i)] b1 inf = 10**18 10**18 inf a,b,q = map(int,input().split()) map(int,input().split()) a s = [-inf]+[int(input()) for _ in range(a)]+[inf] [-inf]+[int(input()) for _ in range(a)]+[inf] s a1 = s[bisect.bisect_right(s,i)] s[bisect.bisect_right(s,i)] a1 b,q = map(int,input().split()) map(int,input().split()) b b2 = t[bisect.bisect_right(t,i)-1] t[bisect.bisect_right(t,i)-1] b2 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 ans = min(ans,abs(i-j)+abs(j-k),abs(i-k)+abs(k-j)) min(ans,abs(i-j)+abs(j-k),abs(i-k)+abs(k-j)) ans x = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] x
import bisect

inf = 10**18

a,b,q = map(int,input().split())
s = [-inf]+[int(input()) for _ in range(a)]+[inf]
t = [-inf]+[int(input()) for _ in range(b)]+[inf]
x = [int(input()) for _ in range(q)]

for i in x:
    a1 = s[bisect.bisect_right(s,i)]
    b1 = t[bisect.bisect_right(t,i)]
    a2 = s[bisect.bisect_right(s,i)-1]
    b2 = t[bisect.bisect_right(t,i)-1]
    ans = inf
    for j in [a1,a2]:
        for k in [b1,b2]:
            ans = min(ans,abs(i-j)+abs(j-k),abs(i-k)+abs(k-j))
    print(ans)