#include <stdio.h>
#include <stdbool.h>

int main(void)
{ 
    while(true){
        int x, y, a;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0){
            break;
        }
        a = 0;
        for (int i = x;i <= y; ++i){
	    if(i % 400 == 0){
                printf("%d\n", i);
                a = 1;
            }else if(i % 100 == 0){
            }else if(i % 4 == 0){
                printf("%d\n", i);
                a = 1;
            } 
        }
        if(a == 0){
            printf("NA\n");
        }
        
    }   
    return 0;        
}