#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

int main(){
  int i,a,b,c,con=0;
  while(1){
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    if(con != 0) cout << endl;

    c = 0;
    for(i=a;i<=b;i++){
      if(i%400 == 0){
	c++;
	cout << i << endl;
      }
      else if(i%100 == 0) continue;
      else if(i%4 == 0){
	c++;
	cout << i << endl;
      }
    }

    if(c == 0) cout << "NA" << endl;
    con++;
  }
  return 0;
}