#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}


int main(){
	int a,b;
	while(cin>>a>>b,a!=0||b!=0){
	bool f=1;
	for(int i=a;i<=b;i++){
	if(i%4==0&&a%4!=0||i%400==0){cout<<i<<endl;f=0;}
	}
	if(f)cout<<"NA\n";
	cout<<endl;
	}
	return 0;
}