INF = 10 ** 14

def compute_edge(arr, q)
  i = arr.bsearch_index { |x| x >= q }
  return [arr.last] if i.nil?
  return [q] if arr[i] == q
  return [arr[0]] if i == 0
  return [arr[i - 1], arr[i]]
end

def lazy_faith(s, t, q)
  ans = INF
  compute_edge(s, q).each do |se|
    min_cost = INF
    cost = (se - q).abs
    compute_edge(t, se).each do |te|
      min_cost = [min_cost, cost + (se - te).abs].min
    end
    ans = [ans, min_cost].min
  end

  compute_edge(t, q).each do |te|
    min_cost = INF
    cost = (te - q).abs
    compute_edge(s, te).each do |se|
      min_cost = [min_cost, cost + (se - te).abs].min
    end
    ans = [ans, min_cost].min
  end
  ans
end


A, B, Q = gets.split.map(&:to_i)
s = []
A.times{ s << gets.to_i }
t = []
B.times{ t << gets.to_i }
Q.times do
  puts lazy_faith(s, t, gets.to_i)
end
