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