
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int main(void){
  int b,e;
  while(cin >> b >> e , b+e){
    bool na=false;
    loop(i,b,e){
      if(i % 4 == 0){
	if(i % 100 == 0){
	  if(i % 400 == 0){
	    cout << i << endl;
	    continue;
	    na = true;
	  }
	  continue;
 	}
	cout << i << endl;
	na = true;
      }
    }
    if(!na)cout << "NA" << endl;
    cout << endl;
  }

}