#include <iostream>
#include <string>
using namespace std;

int z;

int leap(int year){
	if(year % 400 == 0){
		cout << year << endl;
		z++;
	}
	else if (year % 4 == 0){
		if(year % 100 != 0){
			cout << year << endl;
			z++;
		}
	}
	return 0;
}

int main(){
	int a, b;
	while(cin >> a >> b){
		z = -1;
		if (a == 0 && b == 0) { break; }
		for ( int i = a;i<=b;i++){
			leap(i);
		}
		if (z == -1){
			cout << "NA" << endl;
		}
		cout << endl;
	}
	return 0;
}