#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  int a, b;
  while(cin >> a >> b, a, b){
    int cnt = 0;
    for(int i = a; i <= b; i++){
      if(i % 4 == 0){
        if(i % 100 != 0 || i % 400 == 0){
          cout << i << endl;
          cnt++;
        }
      }
    }
    if(cnt == 0){
      cout << "NA" << endl;
    }
    cout << endl;
  }
}