#include <iostream>

using namespace std;

int main(void){

  int a,b;
  while( cin >> a >> b ){

    bool flag = false;
    for( int i = a ; i <= b ; i++ ){
      if( i % 4 == 0 ){
	if( i % 400 == 0 ) cout << i << endl;
	else if( i % 100 == 0 ) continue;
	else cout << i << endl;
	flag = true;
      }
    }
    if(flag) cout << endl;
    else cout << "NA" << endl << endl;
  }
  return 0;
}