#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,count=0;
    while (cin>>a>>b) {
        if (a==0&&b==0) {
            break;
        } else {
            int flag=0;
            count++;
            if (count!=1) {
                cout<<endl;
            }
            for (int i=a;i<=b;i++) {
                if ( (i%4==0)&&(i%100!=0) ) {
                    cout<<i<<endl;
                    flag=1;
                } else if ( (i%100==0)&&(i%400==0) ) {
                    cout<<i<<endl;
                    flag=1;
                }
            }
            if (flag==0) {
                cout<<"NA"<<endl;
            }
        }
    }
}

