#include<iostream>
#include<cstdio>
using namespace std;

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