#include<iostream>
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b;
	while(1){
		c=1;
		for(int i=a;i<=b;i++){
			if(i%4==0&&(i%100>0||i%400==0)){
				cout<<i<<endl;c=0;
			}
			
		}
		if(c)cout<<"NA"<<endl;
		cin>>a>>b;
		if(a==0&&b==0)break;
		else cout<<endl;
	}
	return 0;
}