#include <stdio.h>

void Leap_Year(int start_year, int end_year)
{
    if((start_year != 0) || (end_year != 0)) {
        if(end_year - start_year < 3) {
            if((start_year % 4) < (end_year % 4)) { 
                printf("NA\n");
            }
        } else {
            for(int i = start_year; i <= end_year; ++i) {
                if(i % 400 != 0) {
                    if((i % 100 != 0) && (i % 4 == 0)) {
                        printf("%d\n", i);
                    }
                } else {
                    printf("%d\n", i);
                }
            }
        }
    }
}

int main(void)
{
    int start_year, end_year;
    scanf("%d %d", &start_year, &end_year);
    Leap_Year(start_year, end_year);
    return 0;
}