#include <iostream>
using namespace std;

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