lp = nil

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