#include <iostream>

int main()
{
    int a,b;
    bool flag;
    while (true){
        flag = false;
        std::cin >> a >> b;
        if (a == 0 && b == 0){
            break;
}       for (int i = a;i <= b;i++){
            if ((i % 4 == 0 && i % 100 , 0) || i % 400 == 0){
                std::cout << i << std::endl;
                flag = true;
}
}
        if (flag == false){
            std::cout << "NA" << std::endl;
}
        std::cout << std::endl;
}
    return 0;
}