#include <iostream>

using namespace std;

int main(){
	int a,b;
	int line =0;
	while(cin >> a >> b){
		if(a==0 && b==0) break;
		int count=0;
		if(line !=0) cout << "\n"; line++; 
		for(int i=a; i < b; i++){

			if(i%4==0){
    			if(i%100!=0){
      				cout << i << endl;
      				count++;
    			}
    		}
   	 		else if(i%400==0){
      			cout << i << endl;
      			count++;
    		}
			
		}
		if(count==0) cout << "NA\n";
	}

	return 0;
}