#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a, b;

    while(scanf("%d%d", &a, &b) == 2 && a != 0 && b!= 0) {
        int in = 1;
        int count = 0;
        for(int i = a; i <= b; i+=in) {
            if(i%4 == 0){
                if(i%100 == 0){
                    
                    if (i%400 == 0) {
                        in = 4;
                        count++;
                        cout << i <<endl;
                    }
                    
                }
                else{
                    in = 4;
                    count++;
                    cout << i << endl;
                }
            }
        }
        if(count == 0)
            cout << "NA" << endl;
        cout << endl;
    }

    

        
        
    return 0;
}