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

int main()
{
	int a,b,c;
	while(cin >> a >> b, a||b)
	{
		c=0;
		for(int i=a; i<=b; i++)
		{
			if( (i%4==0 && i%100!=0) || (i%400==0) )
			{
				c++;
				cout << i << endl;
			}
		}
		cout << (c?"\n":"NA\n\n");
	}
}