import calendar as C

j=0

while 1:

    a,b=list(map(int, input().split()))

    if a==0:break

    if j:print()

    j=1

    if sum([1 for i in range(a,b+1) if C.isleap(i)])==0:

        print("NA")

    else:

        for i in range(a,b+1):

            if C.isleap(i):print(i)
from calendar import isleap



flag = False

while True:

    a, b = list(map(int, input().split()))

    if a == 0:

        break

    if flag:

        print()

    flag = True

    ans = [i for i in range(a, b+1) if isleap(i)]

    print(("\n".join(map(str, ans)) if len(ans) else "NA"))
import calendar as C

j = 0
while 1:
    a, b = list(map(int, input().split()))
    if a == 0:
        break
    if j:
        print()
    j = 1
    if sum([1 for i in range(a, b + 1) if C.isleap(i)]) == 0:
        print("NA")
    else:
        for i in range(a, b + 1):
            if C.isleap(i):
                print(i)

from calendar import isleap

flag = False
while True:
    a, b = list(map(int, input().split()))
    if a == 0:
        break
    if flag:
        print()
    flag = True
    ans = [i for i in range(a, b + 1) if isleap(i)]
    print(("\n".join(map(str, ans)) if len(ans) else "NA"))

-import calendar as C +from calendar import isleap -j = 0 -while 1: +flag = False +while True: -    if j: +    if flag: -    j = 1 -    if sum([1 for i in range(a, b + 1) if C.isleap(i)]) == 0: -        print("NA") -    else: -        for i in range(a, b + 1): -            if C.isleap(i): -                print(i) +    flag = True +    ans = [i for i in range(a, b + 1) if isleap(i)] +    print(("\n".join(map(str, ans)) if len(ans) else "NA"))