#include <iostream>
using namespace std;

int main(void) {
	int start, end;
	bool first = true;

	while(cin >> start >> end, start | end) {
		bool flag = false;
		if(!first)
			cout << endl;
		else
			first = false;
		for(int i = start; i < end + 1; i++) {
			if(i % 4 == 0 && (i % 100 != 0 || i % 400 == 0)) {
				cout << i << endl;
				flag = true;
			}
		}
		
		if(!flag)
			cout << "NA" << endl;
	}
}