lp = nil

loop do
  
  a, b = gets.split.map(&:to_i)
  
  break if a == 0
  
  puts if lp
  
  lp = []
  
  for i in a..b
     lp << i if i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)
  end
  
  puts lp.empty? ? "NA" : lp
end