#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>
#include <iomanip>

using namespace std;

int main (void)
{
	for (int u = 0; u < 50; u++)
	{
		long n,m;
		cin >> n >> m;
		if (n == 0 && m == 0)
		{
			break;
		}
		int p = 0;

		for (int i = n; i < m + 1; i++)
		{
			if (i % 4 == 0 && i % 100 != 0)
			{
				p += 1;
				cout << i << endl;
			}
			else if (i % 400 == 0 && i % 100 != 0)
			{
				p += 1;
				cout << i << endl;
			}
			else if (i == m && p == 0)
			{
				cout << "NA" << endl;
			}
		}
		cout << endl;
	}
}
