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