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

int main(){
  int a,b,k,i;
  
  while(1){
    cin>>a>>b;
    if(a==0&&b==0)break;
    k=0;
    for(i=a;i<=b;i++){
      if(i%4==0&&i%100!=0){cout<<i<<endl;k++;}
      if(i%400==0){cout<<i<<endl;}
    }    
    if(k==0)cout<<"NA"<<endl;
  cout<<endl;
  }
return 0;
}