#include<iostream>
using namespace std;

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