#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main()
{
	int a,b,ans;
	bool up=false;
	while(1)
	{
		cin >> a >> b;
		if(a==0&&b==0)break;
		if(up)cout << endl;
		up=true;
		bool check=false;
		for(int i=a;i<=b;i++)
		{
			if(i%400==0)
			{
				cout << i << endl;
				check=true;
			}
			else if(i%100==0)
			{
			}
			else if(i%4==0)
			{
				cout << i << endl;
				check=true;
			}
		}
		if(!(check))cout << "NA" << endl;
	}
	return 0;
}