#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;


const double EPS = 1e-9;

static bool uruu[3000];

int main(){
	for(int i = 0; i < 3000; i+=4){
		uruu[i] = true;
	}
	for(int i = 0; i < 3000; i+=100){
		uruu[i] = false;
	}
	for(int i = 0; i < 3000; i+=400){
		uruu[i] = true;
	}
	

	int a, b;
	bool f = true;
	while(cin >> a >> b, b){
		if(!f){
			cout << endl;
		}
		f = false;
		bool na = true;
		for(int i = a; i <= b; i++){
			if(uruu[i]){
				cout << i << endl;
				na = false;
			}
		}
		if(na){
			cout << "NA" << endl;
		}
	}

	return 0;
}