#include<bits/stdc++.h>
using namespace std;

int a, b;

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