#include <stdio.h>
#include <iostream>
#include <algorithm>

int n;

using namespace std;


int main(){
    int a,b;
    bool first = true;
    while(cin>>a>>b){
        if(a==0&&b==0)break;
        else  if(first){
            first=false;
        }else{
            cout<<endl;
        }
        
        bool flag=true;
        
        for(int i=a; i<=b; i++){
            if(i%400==0){
                cout<<i<<endl;
                flag=false;
            }else if(i%100==0){
                
            }else if( i%4==0){
                cout<<i<<endl;
                flag=false;
            }
        }
        
        if(flag)cout<<"NA"<<endl;
       
    }
}