#include <iostream>

using namespace std; 

int main()
{
	int a, b;
	
	while (cin >> a >> b, a, b){
		bool flag = false;
		
		for (a; a <= b; a++){
			if (a % 4 == 0 && a % 100 != 0 || a % 400 == 0){
				cout << a << endl;
				if (!flag){
					flag = true;
				}
			}
		}
		if (!flag){
			cout << "NA" << endl;
		}
		cout << endl;
	}
	
	return (0);
}