#include<iostream>
using namespace std;

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