#include <stdio.h>

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