#include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	int a,b;

	while( cin >> a >> b && a ){
		int count = 0;
		for( int i = a;i <= b;i++ ){
			if( !(i % 4) ){
				if( !(i % 400) ){count++; cout << i << endl; continue;}
				else if( !(i%100) ) continue;
				cout << i << endl;
				count++;
			}
		}
		if( count == 0 ) cout << "NA" << endl;
	}
	return 0;
}