#include <iostream>
using namespace std;
int main(void){
    int a, b;
    for(int i=0; i < 55; i++){
      cin >> a >> b;
      if(a==0 && b==0){
          break;
      }
      if(i != 0){
          cout << endl;
      }
      if(a%4 == 0){
          if(a == b && a%400 != 0 && a%100 == 0){
              cout << "NA" << endl;
          }else if(a+4 <= b){
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                  if(a%400 != 0 && a%100 == 0){
                    a += 4;
                  }else{
                    cout << a << endl;
                    a+=4;
                  }
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 1){
          if(a+3 == b && a+3%400 != 0 && a+3%100 == 0){
              cout << "NA" << endl;
          }else if(a+3 <= b){
              a += 3;
              int c;
              c= b-a;
              for(int j=0; j <= c/4 ; j++){
                if(a%400 != 0 && a%100 == 0){
                a+=4;
                }else{
                  cout << a << endl;
                  a+=4;
                }
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 2){
          if(a+2 == b && a+2%400 != 0 && a+2%100 == 0){
              cout << "NA" << endl;
          }else if(a+2 <= b){
              a += 2;
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                if(a%400 != 0 && a%100 == 0){
                  a+=4;
                }else{
                  cout << a << endl;
                  a+=4;
                }
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 3){
          if(a+1 == b && a+1%400 != 0 && a+1%100 == 0){
              cout << "NA" << endl;
          }else if(a+1 <= b){
              a += 1;
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                if(a%400 != 0 && a%100 == 0){
                  a+=4;
                }else{
                  cout << a << endl;
                  a+=4;
                }
              }
          }else{
              cout << "NA" << endl;
          }
      }
    }
    
}
