
class Q1029
  def simulate n,m
    if 0 < n
      up = gets.split(" ").map{|x| x.to_i}
    else up = []
    end
    if 0 < m
      down = gets.split(" ").map{|x| x.to_i}
    else down = []
    end
    up.concat(down).sort!
    max = -1
    for i in 0..up.length-2 
      t = up[i + 1] - up[i]
      max = max < t ? t : max
    end
    if max == -1
      max = up[0]
    end
    puts max
    #puts up
  end
  def doIt
    arg = gets.split(" ").map{|x| x.to_i}
    while (0 < arg[0] + arg[1])
      simulate arg[0],arg[1]
      arg = gets.split(" ").map{|x| x.to_i}
    end
  end
end

Q1029.new.doIt