#include <bits/stdc++.h>

using namespace std;

int main() {

    int a, b, isNA;

    while(cin >> a >> b && (a || b)) {

        isNA = 1;

        for(int i = a; i <= b; ++i) {
            if(i == 0) {
                continue;
            }
            if(i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
                cout << i << endl;
                isNA = 0;
            }
        }

        if(isNA == 1) {
            cout << "NA" << endl;
        }

        cout << endl;

    }

}