#include<iostream>
using namespace std;

int start, end;
int ans[800], count;

int main(){
	while(cin >> start >> end, start || end){
		count = 0;
		for(; start <= end; start++){
			if(start % 4 == 0){
				if(start % 100 == 0){
					if(start % 400 == 0){
						ans[count] = start;
						count++;
					}
				}
				ans[count] = start;
				count++;
			}
		}
		if(count == 0) cout << "NA" << endl;
		else{
			for(int i=0; i < count; i++){
				cout << ans[i] << endl;
			}
		}
		cout << endl;
	}
}