from bisect import bisect_left,bisect_right
a,b,q=map(int,input().split())
s=[-(10**21)]+[int(input())for _ in range(a)]+[10**21]
t=[-(10**21)]+[int(input())for _ in range(b)]+[10**21]
for _ in range(q):
  x=int(input())
  s1,s2=s[bisect_right(s,x)-1],s[bisect_right(s,x)]
  t1,t2=t[bisect_right(t,x)-1],t[bisect_right(t,x)]
  ans=10**11
  for i in [s1,s2]:
    for j in [t1,t2]:
      ans=min(ans,abs(i-j)+min(abs(x-i),abs(x-j)))
  print(ans) 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=[-(10**21)]+[int(input())for _ in range(a)]+[10**21] s [-(10**21)]+[int(input())for _ in range(a)]+[10**21] [-(10**21)]+[int(input())for _ in range(a)] [-(10**21)] -(10**21) 10**21 10 21 [int(input())for _ in range(a)] [10**21] 10**21 10 21 int(input())for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t=[-(10**21)]+[int(input())for _ in range(b)]+[10**21] t [-(10**21)]+[int(input())for _ in range(b)]+[10**21] [-(10**21)]+[int(input())for _ in range(b)] [-(10**21)] -(10**21) 10**21 10 21 [int(input())for _ in range(b)] [10**21] 10**21 10 21 for _ in range(q):
  x=int(input())
  s1,s2=s[bisect_right(s,x)-1],s[bisect_right(s,x)]
  t1,t2=t[bisect_right(t,x)-1],t[bisect_right(t,x)]
  ans=10**11
  for i in [s1,s2]:
    for j in [t1,t2]:
      ans=min(ans,abs(i-j)+min(abs(x-i),abs(x-j)))
  print(ans) _ range(q) range q x=int(input()) x int(input()) int input() input s1,s2=s[bisect_right(s,x)-1],s[bisect_right(s,x)] s1 s[bisect_right(s,x)-1] s bisect_right(s,x)-1 bisect_right(s,x) bisect_right s x 1 s2 s[bisect_right(s,x)] s bisect_right(s,x) bisect_right s x t1,t2=t[bisect_right(t,x)-1],t[bisect_right(t,x)] t1 t[bisect_right(t,x)-1] t bisect_right(t,x)-1 bisect_right(t,x) bisect_right t x 1 t2 t[bisect_right(t,x)] t bisect_right(t,x) bisect_right t x ans=10**11 ans 10**11 10 11 for i in [s1,s2]:
    for j in [t1,t2]:
      ans=min(ans,abs(i-j)+min(abs(x-i),abs(x-j)))
   i [s1,s2] s1 s2 for j in [t1,t2]:
      ans=min(ans,abs(i-j)+min(abs(x-i),abs(x-j)))
   j [t1,t2] t1 t2 ans=min(ans,abs(i-j)+min(abs(x-i),abs(x-j))) ans min(ans,abs(i-j)+min(abs(x-i),abs(x-j))) min ans abs(i-j)+min(abs(x-i),abs(x-j)) abs(i-j) abs i-j i j min(abs(x-i),abs(x-j)) min abs(x-i) abs x-i x i abs(x-j) abs x-j x j print(ans) print ans a,b,q=map(int,input().split()) map(int,input().split()) a s2=s[bisect_right(s,x)-1],s[bisect_right(s,x)] s[bisect_right(s,x)] s2 ans=min(ans,abs(i-j)+min(abs(x-i),abs(x-j))) min(ans,abs(i-j)+min(abs(x-i),abs(x-j))) ans b,q=map(int,input().split()) map(int,input().split()) b x=int(input()) int(input()) x s=[-(10**21)]+[int(input())for _ in range(a)]+[10**21] [-(10**21)]+[int(input())for _ in range(a)]+[10**21] s t2=t[bisect_right(t,x)-1],t[bisect_right(t,x)] t[bisect_right(t,x)] t2 t=[-(10**21)]+[int(input())for _ in range(b)]+[10**21] [-(10**21)]+[int(input())for _ in range(b)]+[10**21] t ans=10**11 10**11 ans t1,t2=t[bisect_right(t,x)-1],t[bisect_right(t,x)] t[bisect_right(t,x)-1] t1 q=map(int,input().split()) map(int,input().split()) q s1,s2=s[bisect_right(s,x)-1],s[bisect_right(s,x)] s[bisect_right(s,x)-1] s1
from bisect import bisect_left,bisect_right
a,b,q=map(int,input().split())
s=[-(10**21)]+[int(input())for _ in range(a)]+[10**21]
t=[-(10**21)]+[int(input())for _ in range(b)]+[10**21]
for _ in range(q):
  x=int(input())
  s1,s2=s[bisect_right(s,x)-1],s[bisect_right(s,x)]
  t1,t2=t[bisect_right(t,x)-1],t[bisect_right(t,x)]
  ans=10**11
  for i in [s1,s2]:
    for j in [t1,t2]:
      ans=min(ans,abs(i-j)+min(abs(x-i),abs(x-j)))
  print(ans)