#include <iostream>

using namespace std;

int main(){
	int a,b;
	while(cin >> a >> b){
		int count=0;
		if(a==0 && b==0) break; 
		for(int i=a; i < b; i++){
			if(i % 4==0 && i%100 !=0 || i % 400 ==0) {
				cout << "\n";
				cout << i << "\n";
				count++;
			} 
		}
		if(count==0){
			cout << "\n";
			cout << "NA\n";
		}
	}

	return 0;
}