#include <iostream>

using namespace std;

int main()
{
    int a, b;
    bool flag = false;

    while (cin >> a >> b, a || b) {
        int ans = 0;

        if (flag)
            cout << endl;
        for ( ; a <= b; a++) {
            if (a % 4 == 0 && (a % 100 != 0 || a % 400 == 0)) {
                cout << a << endl;
                ans++;
            }
        }
        if (ans == 0)
            cout << "NA" << endl;
        flag = true;
    }
    
    return 0;
}