#include<iostream>
using namespace std;
int main(){
  int n,m;
  bool x = false;
  while(cin >>n>>m,n||m){
    if(x) cout <<endl;
    x = true;
    bool f = false;
    for(int i=n; i<=m; i++){
      if(i%400 == 0){cout <<i<<endl;f = true;}
      else if(i%100 == 0) continue;
      else if(i%4 == 0){cout <<i<<endl;f = true;}
    }
    if(!f) cout <<"NA"<<endl;
  }
  return 0;
}