Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func isLeapYear(y int) bool {
	return (y%4 == 0 && y%100 > 0) || (y%4 == 0 && y%400 == 0)
}

func cntLeap(y []int) {
	cnt := 0

	for i := y[0]; i <= y[1]; i++ {
		if isLeapYear(i) {
			cnt++
			fmt.Println(i)
		}
	}

	if cnt == 0 {
		fmt.Println("NA")
	}
}

func main() {
	num := 0

	for sc.Scan() {
		y := Sliceconvtoi()

		if y[0] == 0 && y[1] == 0 {
			break
		}

		if num > 0 {
			fmt.Println()
		}

		cntLeap(y)
		num++
	}

}

Python: def check(x) :
    if x % 4 == 0 :
        if   x % 100 != 0 : return x
        elif x % 400 == 0 : return x

def make(a, b):
    count = 0
    for _ in range(a, b+1) :
        if box[0] <= _ <= box[-1] :
            if _ in box :
                count = 1
                print(_)
        else :
            temp = check(_)
            if temp != None : 
                box.append(temp)
                count = 1
                print(_)
    if count == 0 : print('NA')
    
from sys import stdin
box = [2004]
a, b = map(int, input().split())
for _ in stdin.readlines() :
    make(a, b)
    a, b = map(int, _.split())
    if a == b == 0 : break
    print()

Python: # from sys import exit
init = False
while(True):
    A, B = [int(n) for n in input().split()]
    if A == 0 and B == 0:
        exit()
    if init:
        print()

    # N = int(input())
    # a = [int(input()) for _ in range(N)]
    # S = str(input())
    # L = len(S)
    # T = str(input())
    # exit()
    aaa = False
    for a in range(A, B+1):
        if a % 4 == 0:
            if a % 100 == 0 and a % 400 != 0:
                continue
            print(a)
            aaa = True
    if (not aaa):
        print("NA")
    init = True

Python: while True:
    A,B = map(int,input().split())
    if A == 0:
        break
    ans = []
    for i in range(A,B + 1):
        if i % 400 == 0 or (i % 100 != 0 and i % 4 == 0):
            ans.append(i)
    if len(ans) != 0:
        for i in ans:
            print(i)
    else:
        print('NA')
    print('')

Python: def uy(y):
  if not y%4:
    if not y%100:
      if not y%400:
        return y
      return 0
    return y
  return 0

while 1:
  a,b=list(map(int,input().split()))
  if not a and not b:break
  t=[i for i in map(uy,range(a,b+1)) if i]
  if not t:
    print("NA")
  else:
    [print(i) for i in t]
  print("")

Python: while 1:
  a,b=list(map(int,input().split()))
  if not a and not b:break
  t=[i for i in range(a,b+1) if not i%4 and i%100 or not i%400]
  if not t:
    print("NA")
  else:
    [print(i) for i in t]
  print("")

Python: num = 0
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        break
    for i in range(a,b + 1):
        if i % 400 == 0:
            print(i)
            num += 1
        elif i % 100 == 0:
            continue
        elif i % 4 == 0:
            print(i)
            num += 1
    if num == 0:
        print("NA")
    print()

Python: import calendar as C
while 1:
    a,b=map(int, input().split())
    if a==0:break
    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)
    print()

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0093
???????????´
"""
import sys

def is_leap(year):
    ''' ?????????????????´??? ???????????´ ???????????????True/False??§?????? '''
    if year % 400 == 0:
        return True
    elif year % 100 == 0:
        return False
    elif year % 4 == 0:
        return True
    else:
        return False


def main(args):
    leap_years = []  # ???????????´????????????
    # ??????????????\???
    while True:
        start_year, end_year = [int(x) for x in input().strip().split(' ')]
        if start_year == 0 and end_year == 0:
            break
        else:
            # ???????????????
            leap_years = []
            for year in range(start_year, end_year+1):
                if is_leap(year):
                    leap_years.append(year)

        # ???????????????
        if len(leap_years) == 0:
            print('NA')
        else:
            print('{0}'.format('\n'.join(map(str, leap_years))))
        print('')  # ????????????????????????1????????????

if __name__ == '__main__':
    main(sys.argv[1:])

Python: import sys
f = sys.stdin

def is_leapyear(year):
    return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)

while True:
    a, b = map(int, f.readline().split())
    if a == b == 0:
        break
    leapyear = [year for year in range(a, b + 1) if is_leapyear(year)]
    print('\n'.join(map(str, leapyear)) if leapyear else 'NA')
    print()

Python: while 1:
  a,b=list(map(int,input().split()))
  if not a:break
  t=[i for i in range(a,b+1) if not i%4 and i%100 or not i%400]
  if not t:
    print("NA")
  else:
    [print(i) for i in t]
  print()

Python: import calendar as C
while 1:
    a,b=map(int, input().split())
    if a==0:break
    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)and i%100!=0:print(i)

Python: while 1:
  a,b=list(map(int,input().split()))
  if not a:break
  t=[i for i in range(a,b+1) if not i%4 and i%100 or not i%400]
  print("")
  if not t:
    print("NA")
  else:
    [print(i) for i in t]

Python: p=print
b=0
for e in iter(input,'0 0'):
 if b:p()
 b=f=1;s,t=map(int,e.split())
 for y in range(s,t+1):
  if(y%4==0)*(y%100)or y%400==0:p(y);f=0
 if u:p('NA')

Python: first = True
while True:
    a, b = map(int, input().split())
    if a == b == 0: break

    if not first: print()
    first = False

    count = 0
    for y in range(a, b + 1):
        if y % 400 == 0 or y % 4 == 0 and y % 100 != 0:
            count += 1
            print(y)
    if count == 0: print('NA')

Python: while True:
    a, b = map(int, input().split())
    if a == b == 0:
        quit()
    count = 0
    for i in range(a, b+1):
        if i % 400 == 0:
            print(i)
            count += 1
        elif i % 100 != 0 and i % 4 == 0:
            print(i)
            count += 1
    if count == 0:
        print('NA')
    print()

Python: # -*- coding: utf-8 -*-
while True:
    a, b = map(int, input().split())

    if a == 0 and b == 0:
        break

    found = False
    for y in range(a, b + 1):
        if y % 4 == 0 and (y % 100 != 0 or y % 400 == 0):
            found = True
            print(y)
    if not found:
        print('NA')
    print()

Python: from calendar import isleap
s = []
while True:
    a, b = map(int, input().split())
    if not a:
        break
    s.append([])
    for i in range(a, b + 1):
        if isleap(i):
            s[-1].append(str(i))

print('\n\n'.join(['\n'.join(ss) if ss else 'NA' for ss in s]))

Python: def isLeap(y):
    return y % 4 == 0 and (y % 100 != 0 or y % 400 == 0)

flag2 = False
while True:
    a,b = map(int,input().split())
    if a == 0: break
    if flag2:print()
    flag2 = True

    flag = True
    for y in range(a,b + 1):
        if isLeap(y):
            print(y)
            flag = False
    if(flag):print("NA")

Python: import sys;

#file = open("text.txt")
file = sys.stdin

def is_leap_year(year) :
    if  year % 400 == 0 : return True
    if year % 100 == 0 : return False
    if year % 4 == 0 : return True
    return False

while True :
    a, b = map(int, file.readline().split(" "))
    if a==0 and b==0 : break

    v = 0
    for y in range(a, b+1) :
        if is_leap_year(y) :
            v = 1
            print(y)
    pass
    if v == 0: print("NA")
    print()
pass