from bisect import bisect_left as bl
a,b,q = map(int,input().split())

s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]
s.insert(0,-10**12)
s.append(10**12)
t.insert(0,-10**12)
t.append(10**12)

for i in range(q):
    x = int(input())
    si = bl(s,x)
    ti = bl(t,x)
    ans = 10**12
    for j in range(si-1,si+1):
        for k in range(ti-1,ti+1):
            if s[j] <= t[k]:
                if t[k] <= x:
                    ans = min(ans,x-s[j])
                elif x <= s[j]:
                    ans = min(ans,t[k]-x)
                else:
                    ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j])
            else:
                if s[j] <= x:
                    ans = min(ans,x-t[k])
                elif x <= t[k]:
                    ans = min(ans,s[j]-x)
                else:
                    ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k])
    print(ans)  from bisect import bisect_left as bl 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)] s.insert(0,-10**12) s.insert s insert 0 -10**12 -10 12 s.append(10**12) s.append s append 10**12 10 12 t.insert(0,-10**12) t.insert t insert 0 -10**12 -10 12 t.append(10**12) t.append t append 10**12 10 12 for i in range(q):
    x = int(input())
    si = bl(s,x)
    ti = bl(t,x)
    ans = 10**12
    for j in range(si-1,si+1):
        for k in range(ti-1,ti+1):
            if s[j] <= t[k]:
                if t[k] <= x:
                    ans = min(ans,x-s[j])
                elif x <= s[j]:
                    ans = min(ans,t[k]-x)
                else:
                    ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j])
            else:
                if s[j] <= x:
                    ans = min(ans,x-t[k])
                elif x <= t[k]:
                    ans = min(ans,s[j]-x)
                else:
                    ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k])
    print(ans)  i range(q) range q x = int(input()) x int(input()) int input() input si = bl(s,x) si bl(s,x) bl s x ti = bl(t,x) ti bl(t,x) bl t x ans = 10**12 ans 10**12 10 12 for j in range(si-1,si+1):
        for k in range(ti-1,ti+1):
            if s[j] <= t[k]:
                if t[k] <= x:
                    ans = min(ans,x-s[j])
                elif x <= s[j]:
                    ans = min(ans,t[k]-x)
                else:
                    ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j])
            else:
                if s[j] <= x:
                    ans = min(ans,x-t[k])
                elif x <= t[k]:
                    ans = min(ans,s[j]-x)
                else:
                    ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k])
     j range(si-1,si+1) range si-1 si 1 si+1 si 1 for k in range(ti-1,ti+1):
            if s[j] <= t[k]:
                if t[k] <= x:
                    ans = min(ans,x-s[j])
                elif x <= s[j]:
                    ans = min(ans,t[k]-x)
                else:
                    ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j])
            else:
                if s[j] <= x:
                    ans = min(ans,x-t[k])
                elif x <= t[k]:
                    ans = min(ans,s[j]-x)
                else:
                    ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k])
     k range(ti-1,ti+1) range ti-1 ti 1 ti+1 ti 1 if s[j] <= t[k]:
                if t[k] <= x:
                    ans = min(ans,x-s[j])
                elif x <= s[j]:
                    ans = min(ans,t[k]-x)
                else:
                    ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j])
            else:
                if s[j] <= x:
                    ans = min(ans,x-t[k])
                elif x <= t[k]:
                    ans = min(ans,s[j]-x)
                else:
                    ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k])
     s[j] <= t[k] s[j] s j t[k] t k if t[k] <= x:
                    ans = min(ans,x-s[j])
                elif x <= s[j]:
                    ans = min(ans,t[k]-x)
                else:
                    ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j])
             t[k] <= x t[k] t k x ans = min(ans,x-s[j]) ans min(ans,x-s[j]) min ans x-s[j] x s[j] s j elif x <= s[j]:
                    ans = min(ans,t[k]-x)
                 x <= s[j] x s[j] s j ans = min(ans,t[k]-x) ans min(ans,t[k]-x) min ans t[k]-x t[k] t k x ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j]) ans min(ans,min(x-s[j],t[k]-x)+t[k]-s[j]) min ans min(x-s[j],t[k]-x)+t[k]-s[j] min(x-s[j],t[k]-x)+t[k] min(x-s[j],t[k]-x) min x-s[j] x s[j] s j t[k]-x t[k] t k x t[k] t k s[j] s j if s[j] <= x:
                    ans = min(ans,x-t[k])
                elif x <= t[k]:
                    ans = min(ans,s[j]-x)
                else:
                    ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k])
     s[j] <= x s[j] s j x ans = min(ans,x-t[k]) ans min(ans,x-t[k]) min ans x-t[k] x t[k] t k elif x <= t[k]:
                    ans = min(ans,s[j]-x)
                 x <= t[k] x t[k] t k ans = min(ans,s[j]-x) ans min(ans,s[j]-x) min ans s[j]-x s[j] s j x ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k]) ans min(ans,min(x-t[k],s[j]-x)+s[j]-t[k]) min ans min(x-t[k],s[j]-x)+s[j]-t[k] min(x-t[k],s[j]-x)+s[j] min(x-t[k],s[j]-x) min x-t[k] x t[k] t k s[j]-x s[j] s j x s[j] s j t[k] t k print(ans) print ans a,b,q = map(int,input().split()) map(int,input().split()) a ans = min(ans,x-s[j]) min(ans,x-s[j]) ans b,q = map(int,input().split()) map(int,input().split()) b ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k]) min(ans,min(x-t[k],s[j]-x)+s[j]-t[k]) ans x = int(input()) int(input()) x ti = bl(t,x) bl(t,x) ti q = map(int,input().split()) map(int,input().split()) q si = bl(s,x) bl(s,x) si ans = min(ans,x-t[k]) min(ans,x-t[k]) ans s = [int(input()) for i in range(a)] [int(input()) for i in range(a)] s t = [int(input()) for i in range(b)] [int(input()) for i in range(b)] t ans = min(ans,t[k]-x) min(ans,t[k]-x) ans ans = min(ans,s[j]-x) min(ans,s[j]-x) ans ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j]) min(ans,min(x-s[j],t[k]-x)+t[k]-s[j]) ans ans = 10**12 10**12 ans
from bisect import bisect_left as bl
a,b,q = map(int,input().split())

s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]
s.insert(0,-10**12)
s.append(10**12)
t.insert(0,-10**12)
t.append(10**12)

for i in range(q):
    x = int(input())
    si = bl(s,x)
    ti = bl(t,x)
    ans = 10**12
    for j in range(si-1,si+1):
        for k in range(ti-1,ti+1):
            if s[j] <= t[k]:
                if t[k] <= x:
                    ans = min(ans,x-s[j])
                elif x <= s[j]:
                    ans = min(ans,t[k]-x)
                else:
                    ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j])
            else:
                if s[j] <= x:
                    ans = min(ans,x-t[k])
                elif x <= t[k]:
                    ans = min(ans,s[j]-x)
                else:
                    ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k])
    print(ans) 
