#include<iostream>
using namespace std;
int main(){
  int bell,hess,aizu;
  while(1){
    aizu=0;
    cin >> bell >> hess;
    if(bell==0 && hess==0){
      break;
    }
    for(int i=bell;i<=hess;i++){
      if(i%4==0){
	if(i%100!=0){
	  cout << i << endl;
	  aizu++;
	}
	else if(i%400==0){
	  cout << i << endl;
	  aizu++;
	}
      }
    }
    if(aizu==0){
      cout << "NA" << endl;
    }
    cout << endl;
    aizu=0;
  }
}