A,B,Q=map(int,input().split())
s=[int(input()) for i in range(A)]
t=[int(input()) for i in range(B)]
X=[int(input()) for i in range(Q)]
s.append(2*10**10+1)
t.append(2*10**10+1)
import bisect
for i in range(Q):
  a=bisect.bisect_left(s,X[i])
  b=bisect.bisect_left(t,X[i])
  s1,s2=s[a-1],s[a]
  t1,t2=t[b-1],t[b]
  ans=10**10*2
  for k in [s[a],s[a-1]]:
    for j in [t[b],t[b-1]]:
      d=abs(k-j)+min(abs(k-X[i]),abs(j-X[i]))
      ans=min(ans,d)
  print(ans) 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)] int(input()) for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) int(input()) int input() input X=[int(input()) for i in range(Q)] X [int(input()) for i in range(Q)] s.append(2*10**10+1) s.append s append 2*10**10+1 2*10**10 2 10**10 10 10 1 t.append(2*10**10+1) t.append t append 2*10**10+1 2*10**10 2 10**10 10 10 1 import bisect bisect for i in range(Q):
  a=bisect.bisect_left(s,X[i])
  b=bisect.bisect_left(t,X[i])
  s1,s2=s[a-1],s[a]
  t1,t2=t[b-1],t[b]
  ans=10**10*2
  for k in [s[a],s[a-1]]:
    for j in [t[b],t[b-1]]:
      d=abs(k-j)+min(abs(k-X[i]),abs(j-X[i]))
      ans=min(ans,d)
  print(ans) i range(Q) range Q a=bisect.bisect_left(s,X[i]) a bisect.bisect_left(s,X[i]) bisect.bisect_left bisect bisect_left s X[i] X i b=bisect.bisect_left(t,X[i]) b bisect.bisect_left(t,X[i]) bisect.bisect_left bisect bisect_left t X[i] X i s1,s2=s[a-1],s[a] s1 s[a-1] s a-1 a 1 s2 s[a] s a t1,t2=t[b-1],t[b] t1 t[b-1] t b-1 b 1 t2 t[b] t b ans=10**10*2 ans 10**10*2 10**10 10 10 2 for k in [s[a],s[a-1]]:
    for j in [t[b],t[b-1]]:
      d=abs(k-j)+min(abs(k-X[i]),abs(j-X[i]))
      ans=min(ans,d)
   k [s[a],s[a-1]] s[a] s a s[a-1] s a-1 a 1 for j in [t[b],t[b-1]]:
      d=abs(k-j)+min(abs(k-X[i]),abs(j-X[i]))
      ans=min(ans,d)
   j [t[b],t[b-1]] t[b] t b t[b-1] t b-1 b 1 d=abs(k-j)+min(abs(k-X[i]),abs(j-X[i])) d abs(k-j)+min(abs(k-X[i]),abs(j-X[i])) abs(k-j) abs k-j k j min(abs(k-X[i]),abs(j-X[i])) min abs(k-X[i]) abs k-X[i] k X[i] X i abs(j-X[i]) abs j-X[i] j X[i] X i ans=min(ans,d) ans min(ans,d) min ans d print(ans) print ans s=[int(input()) for i in range(A)] [int(input()) for i in range(A)] s X=[int(input()) for i in range(Q)] [int(input()) for i in range(Q)] X ans=10**10*2 10**10*2 ans b=bisect.bisect_left(t,X[i]) bisect.bisect_left(t,X[i]) b s1,s2=s[a-1],s[a] s[a-1] s1 s2=s[a-1],s[a] s[a] s2 a=bisect.bisect_left(s,X[i]) bisect.bisect_left(s,X[i]) a A,B,Q=map(int,input().split()) map(int,input().split()) A t1,t2=t[b-1],t[b] t[b-1] t1 t2=t[b-1],t[b] t[b] t2 ans=min(ans,d) min(ans,d) ans 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 d=abs(k-j)+min(abs(k-X[i]),abs(j-X[i])) abs(k-j)+min(abs(k-X[i]),abs(j-X[i])) d B,Q=map(int,input().split()) map(int,input().split()) B
A,B,Q=map(int,input().split())
s=[int(input()) for i in range(A)]
t=[int(input()) for i in range(B)]
X=[int(input()) for i in range(Q)]
s.append(2*10**10+1)
t.append(2*10**10+1)
import bisect
for i in range(Q):
  a=bisect.bisect_left(s,X[i])
  b=bisect.bisect_left(t,X[i])
  s1,s2=s[a-1],s[a]
  t1,t2=t[b-1],t[b]
  ans=10**10*2
  for k in [s[a],s[a-1]]:
    for j in [t[b],t[b-1]]:
      d=abs(k-j)+min(abs(k-X[i]),abs(j-X[i]))
      ans=min(ans,d)
  print(ans)