A,B,Q=gets.split.map(&:to_i)
s,t=[],[]
ans = []
A.times do
  s << gets.to_i
end
B.times do
  t << gets.to_i
end
Q.times do
  x = gets.to_i
  s_higher = s.bsearch{|si| x <= si} || 10**11
  s_lower = s[s.bsearch_index{|si| x <= si}.to_i-1]
  sx = (s_higher - x).abs < (s_lower - x).abs ? s_higher : s_lower
  t_higher = t.bsearch{|ti| x <= ti} || 10**11
  t_lower = t[t.bsearch_index{|ti| x <= ti}.to_i-1]
  tx = (t_higher - x).abs < (t_lower - x).abs ? t_higher : t_lower

  s_higher = s.bsearch{|si| tx <= si} || 10**11
  s_lower = s[s.bsearch_index{|si| tx <= si}.to_i-1]
  sx_t = (s_higher - tx).abs < (s_lower - tx).abs ? s_higher : s_lower
  t_higher = t.bsearch{|ti| sx <= ti} || 10**11
  t_lower = t[t.bsearch_index{|ti| sx <= ti}.to_i-1]
  tx_s = (t_higher - sx).abs < (t_lower - sx).abs ? t_higher : t_lower

  ans_tmp = 10**22
  if (sx <= x && x <= tx) || (tx <= x && x <= sx)
    ans_tmp = (x-sx).abs + (sx-tx).abs if ans_tmp > (x-sx).abs + (sx-tx).abs
    ans_tmp = (x-tx).abs + (sx-tx).abs if ans_tmp > (x-tx).abs + (sx-tx).abs
  else
    tmp = (x-tx).abs > (x-sx).abs ? tx : sx
    ans_tmp = (tmp-x).abs if ans_tmp >(tmp-x).abs
  end
  if (sx <= x && x <= tx_s) || (tx_s <= x && x <= sx)
    ans_tmp = (x-sx).abs + (sx-tx_s).abs if ans_tmp > (x-sx).abs + (sx-tx_s).abs
    ans_tmp = (x-tx_s).abs + (sx-tx_s).abs if ans_tmp > (x-tx_s).abs + (sx-tx_s).abs
  else
    tmp = (x-tx_s).abs > (x-sx).abs ? tx_s : sx
    ans_tmp = (tmp-x).abs if ans_tmp >(tmp-x).abs
  end
  if (sx_t <= x && x <= tx) || (tx <= x && x <= sx_t)
    ans_tmp = (x-sx_t).abs + (sx_t-tx).abs if ans_tmp > (x-sx_t).abs + (sx_t-tx).abs
    ans_tmp = (x-tx).abs + (sx_t-tx).abs if ans_tmp > (x-tx).abs + (sx_t-tx).abs
  else
    tmp = (x-tx).abs > (x-sx_t).abs ? tx : sx_t
    ans_tmp = (tmp-x).abs if ans_tmp >(tmp-x).abs
  end
  ans << ans_tmp
end
puts ans
