#include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int a,b;
  while( cin >> a >> b , a+b){
    int f = 1;
    for(int i = a ; i <= b ; i++){
      if(i%4 == 0){
	if(i%100 != 0 || i%400 == 0){
	  cout << i << endl;
	  f = 0;
	}
      }
    }
    if(f) cout << "NA" << endl;
  }
  return 0;
}