#include<bits/stdc++.h>
using namespace std;
int main()
{
    int fiyear,finyear,co=0;
    while(cin>>fiyear>>finyear&&fiyear!=0&&finyear!=0){
        for(int i=fiyear;i<=finyear;i++){
            if(i%4==0){
                co=1;
                if(i%100!=0||i%400==0)cout<<i<<endl;
            }
        }
        if(co==0)cout<<"NA"<<endl;
        cout<<endl;
        co=0;
    }
}