#include <iostream>
#include <cstdio>

using namespace std;

int main(){
	
	int a, b;
	
	bool first;
	
	cin >> a >> b;
	
	while(a != 0 && b != 0){
		
		first = false;
		
		for(int i = a; i <= b; i++){
			if(i % 4 == 0){
				if(i % 100 == 0){
					if(i % 400 == 0){
						printf("%d\n", i);
						first = true;
						continue;
					}
					continue;
				}
				printf("%d\n", i);
				first = true;
				continue;
			}
		}
		
		if(!first){
			printf("NA\n");
		}
		
		printf("\n");
		
		cin >> a >> b;
	}
	
	return 0;
}