#include <stdio.h>

int main(){

	int a,b;
	int i;
	int answer;
	int count;
	int j = 1;

	while(scanf("%d %d",&a,&b),a,b){
		count = 0;

		if(j != 1){
			printf("\n");
		}
		for(i = a; i < b; i++){
			if( i % 400 == 0 || i % 100 !=0 && i % 4 ==0){
				printf("%d\n",i);
				count = 1;
			}
		}
		if(count == 0){
			printf("NA\n");
		}
		j++;
	}

	return 0;
}