#include <stdio.h>

int count_number(void);

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