a,b,q = gets.split.map(&:to_i)

shrines = []
temples = []

a.times do
  shrines << gets.to_i
end
b.times do
  temples << gets.to_i
end

def calc_dist(x,y)
  x + y + [x,y].min
end

ans = q.times.map do
  x = gets.to_i
  
  east_shrine_index = shrines.bsearch_index do |v|
    x < v
  end

  east_shrine = if east_shrine_index then shrines[east_shrine_index] end
  west_shrine = case east_shrine_index when 0 then nil when nil then shrines[-1] else shrines[east_shrine_index-1] end

  east_temple_index = temples.bsearch_index do |v|
    x < v
  end

  east_temple = if east_temple_index then temples[east_temple_index] end
  west_temple = case east_temple_index when 0 then nil when nil then temples[-1] else temples[east_temple_index-1] end

  possibles = []
  possibles << [east_shrine-x,east_temple-x].max  if east_shrine && east_temple
  possibles << calc_dist((east_shrine-x),(x-west_temple)) if east_shrine && west_temple
  possibles << calc_dist((x-west_shrine),(east_temple-x)) if west_shrine && east_temple
  possibles << [x-west_shrine,x-west_temple].max  if west_shrine && west_temple

  possibles.min
end.join("\n")

print ans
