#include <iostream>

using namespace std;

void solve()
{
	int a, b;
	while(cin >> a >> b, a || b)
	{
		int count = 0;
		for(int i = a; i <= b; ++i)
		{
			if(i % 4 == 0)
			{
				if(i % 100 == 0 && i % 400 == 0)
				{
					cout << i << endl;
					++count;
				}
				else if(i % 100 != 0)
				{
					cout << i << endl;
					++count;
				}
			}
		}
		if(count == 0)
		{
			cout << "NA" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}