a, b, q = gets.split.map(&:to_i)
aa = (0...a).map{|_| gets.to_i}.sort
bb = (0...b).map{|_| gets.to_i}.sort
qq = (0...q).map{|_| gets.to_i}
INF = 10**11

comb = []
for x in [aa, bb]
  for y in [0, 1]
    for z in [0, 1]
      comb << [x, (x == aa ? bb : aa), y, z]
    end
  end
end

qq.each do |qqq|
  p comb.map {|s, t, d1, d2|
    x = qqq
    yi = (s.bsearch_index{|y| y >= x} or s.size) - d1
    next INF if yi < 0 or yi >= s.size
    y = s[yi]
    zi = (t.bsearch_index{|z| z >= y} or t.size) - d2
    next INF if zi < 0 or zi >= t.size
    z = t[zi]
    (y-x).abs + (z-y).abs
  }.min
end