def former(array, value)
  array.bsearch do |x|
    x >= value
  end
end

def latter(array, value)
  i = array.bsearch_index do |x|
    x >= value
  end
  i ||= array.size
  if i >= 1
    array[i - 1]
  else
    nil
  end
end

A, B, Q = gets.split.map(&:to_i)
s_list = A.times.map { gets.to_i }.sort
t_list = B.times.map { gets.to_i }.sort
Q.times do
  ans = 10 << 60
  q = gets.to_i
  # s
  2.times do |i|
    s = i == 0 ? former(s_list, q) : latter(s_list, q)
    next unless s
    sd = (s - q).abs
    2.times do |j|
      t = j == 0 ? former(t_list, s) : latter(t_list, s)
      next unless t
      td = (s - t).abs
      ans = sd + td if ans > sd + td
    end
  end
  # t
  2.times do |i|
    t = i == 0 ? former(t_list, q) : latter(t_list, q)
    next unless t
    td = (t - q).abs
    2.times do |j|
      s = j == 0 ? former(s_list, t) : latter(s_list, t)
      next unless s
      sd = (s - t).abs
      ans = sd + td if ans > sd + td
    end
  end
  puts ans
end
