#include<iostream>
using namespace std;

int main(){
	int a,b,count=0;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0){
			break;
		}
		while(a<=b){
			if(a%4==0){
				if(a%100==0){
					if(a%400==0){
						cout<<a<<endl;
						count++;
					}
				}else{
					cout<<a<<endl;
					count++;
				}
			}
			a++;
		}
		if(count==0){
			cout<<"NA"<<endl;
		}
		count=0;
		cout<<endl;
	}
	return 0;
}