#include<stdio.h>
 
int main(){
	int a, b, i;
	while(scanf("%d %d", &a, &b) != 0){
		if(a == 0 || b == 0) break;
		for(i = a; i <= b; i++){
			if(i % 400 == 0) printf("%d\n", i);
			else if(i % 100 == 0) printf("NA\n");
			else if(i % 4 == 0) printf("%d\n", i);
			else printf("NA\n");
		}
	}
	return 0;
}