#include <iostream>
using namespace std;

int main()
{
	int syear,eyear;
	while(cin >> syear && cin >> eyear){
		if(syear == 0)
			break;
		bool flag = false;
		for(int i=syear;i<=eyear;i++){
			if(i%4==0){
				if(i%400==0){
					flag = true;
					cout << i << endl;
				}
				else if(i%100==0){
				}
				else{
					flag = true;
					cout << i << endl;
				}
			}
		}
		if(flag==false)
			cout << "NA" << endl;
		cout << endl;
	}
	return 0;
}