#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

bool is_leap (int y )
{
	return (y % 4 == 0 && ((y % 100 != 0 ) || (y % 400 == 0 ) ) );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.leap_year", "r", stdin );

	int a, b;
	int cnt = 0;
	while (scanf ("%d %d", &a, &b ), a, b  ){
		vector<int> res; res.clear();
		for (int i = a; i <= b; i++ ){
			if (is_leap (i ) ){
				res.push_back (i );
			} // end if
		} // end for
		if (cnt != 0 ) cout << endl;
		cnt++;
		if (res.empty() ){
			cout << "NA" << endl;
		}else{
			rep (i, res.size() ){
				printf ("%d\n", res[i] );
			} // end rep
		} // end if
	} // end while

	return 0;
}