#include <bits/stdc++.h>
using namespace std;

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