#include <iostream>
#include <string>
using namespace std;

int main()
{
	int a,b;
	while(cin >> a >> b && a && b)
	{
		bool flag = false;
		for(;a<=b;a++)
		{
			if(!(a%400)){cout << a <<endl;flag=true;continue;}
			if(!(a%4) && a%100){cout << a << endl;flag=true;}
		}
		if(!flag)cout << "NA" << endl;
		cout << endl;
	}
}