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


main(){
	bool first = true;
	for(int a,b;cin>>a>>b,0<a&&0<b;){

		if(!first){
			puts("");
		}

		first = false;

		int cnt=0;
		for(int year=a; year<=b; ++year){
			if( year%400==0 || (year%100!=0&&year%4==0) ){
				cout<<year<<endl;
				cnt++;
			}
		}
		if(cnt==0){
			puts("NA");
		}
	}
}
