#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int i,j,k;
int a,b,ans;

int main(){
	scanf("%d %d",&a,&b);
	while(a!=0 && b!=0){
		printf("\n");
		ans=0;
		for(i=a;i<=b;i++){
			if(i%4==0){
				if(i%100!=0)printf("%d\n",i),ans++;
				else if(i%400==0)printf("%d\n",i),ans++;
				i+=3;
			}
		}
		if(ans==0)printf("NA\n");
		
		scanf("%d %d",&a,&b);
	}
	
	return 0;
}