#include <iostream>
using namespace std;

int main(){
    int a,b;
    
    while(1){
        int flg = 0;
        cin >> a >> b;
        if(a==0&&b==0) break;
        
        for(int i = a ; i <= b ; i++){
            if(i%4==0) {
                if(i%100==0 && i%400!=0) continue;
                else{
                    cout << i << endl;
                    flg = 1;
                }
            }
        }
        if(flg == 0) cout << "NA" << endl;
        cout << endl;
    }
    
    
    return 0;
}