#include <stdio.h>

int main(){

	int a,b;
	int i;
	int answer[1000];
	int count;

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

		if(a == 0 && b == 0){
			break;
		}

		for(i = a; i < b; i++){
			if(i % 4 == 0){
				if(i % 100 != 0 || i % 400 == 0){
					answer[count] = i;
					count ++;
				}
			}
		}

		for(i = 0; i < count; i++){
			printf("%d\n",answer[i]);
		}
		if(count == 0){
			printf("NA\n");
		}
	}

	return 0;
}