leap=[]
while true
	puts  if leap.size!=0
	leap=[]
	a,b=gets.split().map{|x| x.to_i}
	break if a==0 && b==0
	a.upto(b){|n|
		leap<<n if n%400==0 || (n%4==0 && n%100!=0)
	}
	if leap.size==0
		puts "NA"
	else
		leap.each{|y| puts y}
	end
end

		