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: f = set(range(0,3000,4))
h = set(range(0,3000,100))
fh = set(range(0,3000,400))
lp = (f -h).union(fh)
 
a = False
while True:
  f,l = list(map(int, input().split()))
  if f == 0 and l == 0:
    break
  if a:
    print (' ')
  t = set(range(f,l+1))
  it = sorted(list(lp.intersection(t)))
  for y in it:
    print(y)
  if len(it) == 0:
    print('NA')
  a = True

Python: is_not_first = 0
while True:
  a, b = map(int, input().split())
  if not a:
    break
   
  if is_not_first:
    print()
  is_not_first += 1
 
  print_flag = 0
  for year in range(a, b + 1):
    if (not year % 4) and ((not (not year % 100)) or (not year % 400)):
      print(year)
      print_flag = 1
 
  if not print_flag:
    print("NA")

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]

Python: from calendar import isleap

f = True
while True:
    a, b = map(int, input().split())
    if a == b == 0: break
    leap = [str(i) for i in range(a, b+1) if isleap(i)]
    if f:
        f = False
    else:
        print()
    if not leap:
        print('NA')
    else:
        print('\n'.join(leap))

Python: # AOJ 0093 Leap Year
# Python3 2018.6.11 bal4u

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

import sys
first = True
for line in sys.stdin:
    a, b = list(map(int, line.split()))
    if a == 0:
        break
    else:
        if first:
            first = False
        else:
            print()

        f = False
        for y in range(a, b+1):
            if leap_year(y):
                print(y)
                f = True
        if not f:
            print('NA')

Python: b=0
for e in iter(input,'0 0'):
 if b:print()
 b=1
 s,t=map(int,e.split())
 u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0]
 if u:
  for y in u:print(y)
 else:print('NA')

Python: while True:
    a, b = map(int, input().split())
    if a == b == 0:
        break
    fla = False
    for y in range(a, b+1):
        if y % 4 == 0:
            if y % 100 != 0:
                fla = True
                print(y)
            else:
                if y % 400 == 0:
                    fla = True
                    print(y)
    else:
        if not fla:
            print('NA')

Python: import sys
readline = sys.stdin.readline
write = sys.stdout.write
def count(k):
    return k // 4 - k // 100 + k // 400
def solve(i):
    a, b = map(int, readline().split())
    if a == b == 0:
        return False
    if i:
        write("\n")
    ans = []
    for k in range((a+3)//4*4, b+1, 4):
        if k % 100 > 0 or k % 400 == 0:
            ans.append(k)
    if ans:
        for k in ans:
            write("%d\n" % k)
    else:
        write("NA\n")
    return True
i = 0
while solve(i):
    i += 1

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

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

    if csp:
        print()

    csp = 1

    a = (a+3)//4 *4

    lst = [i for i in range(a,b+1,4) if i %100 != 0 or i %400 == 0]

    if lst == []:
        print('NA')

    else:
        for i in lst:
            print(i)

Python: 
def isLeap(y):
    if y % 400 == 0:
        return True
    if y % 100 == 0:
        return False
    if y % 4 == 0:
        return True
    else:
        return False
c = 0
while True:
    a, b = [int(x) for x in input().split()]
    if a  == 0 and b == 0:
        break
    if c > 0:
        print()
    c +=1
    f = 0
    for i in range(a,b+1):
        if isLeap(i):
            f += 1
            print(i)
    if f == 0:
        print("NA")

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("")
    [print(i) for i in t]

Python: result = []
while True:
    a, b = map(int, input().split())
    if a == b == 0:
        break
    result.append("\n".join([str(i) for i in range(a, b+1) if i%400 == 0 or i%4 == 0 and i%100]) or "NA")

print("\n\n".join(result))

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

Python: def f(a, b):
    flg = False
    for x in range(a, b + 1):
        if (x % 4 == 0 and x % 100 != 0) or x % 400 == 0:
            if not flg:
                flg = True
            print(x)
    if not flg:
        print('NA')


while True:
    _a, _b = map(int, input().split())
    if _a == _b == 0:
        break
    f(_a, _b)

Python: from calendar import isleap

while True:
    a, b = map(int, input().split())
    if a == 0:
        break
    ans = [i for i in range(a, b+1) if isleap(i)]
    print("\n".join(map(str, ans)) if len(ans) else "NA")
    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):
    is_first__dataset = True
    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 is_first__dataset == True:
            is_first__dataset = False
        else:
            print('')  # ????????????????????????1????????????

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

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

Python: f = set(range(0,3000,4))
h = set(range(0,3000,100))
fh = set(range(0,3000,400))
lp = (f -h).union(fh)
 
a = False
while True:
  f,l = list(map(int, input().split()))
  if f == 0 and l == 0:
    break
  if a:
    print ('')
  t = set(range(f,l+1))
  it = sorted(list(lp.intersection(t)))
  for y in it:
    print(y)
  if len(it) == 0:
    print('NA')
  a = True

Python: for e in iter(input,'0 0'):
 s,t=map(int,e.split())
 u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0]
 if u:
  for y in u:print(y)
 else:print('NA')
 print()

Python: from calendar import isleap

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