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 isUruu(y):
    if y % 4 == 0:
        if y % 100 == 0:
            if y % 400 == 0:
                return True
            else:
                return False
        else:
            return True
    else:
        return False

first = True
while True:
    a,b = [int(i) for i in input().split()]
    if a == 0 and b == 0:
        break

    if first:
        first = False
    else:
        print("")

    flag = False
    for i in range(a,b+1):
        if isUruu(i):
            flag = True
            print(i)

    if not flag:
        print("NA")

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

    uru = [str(i) for i in range(a, b+1) if i % 400 == 0 or (i % 4 == 0 and i % 100 != 0)]
    result = '\n'.join(uru)

    if not result:
        result = 'NA'
    print(result)
    print()

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 f:p('NA')

Python: p=print
b=0
for e in iter(input,'0 0'):
 if b:p()
 b=u=1;s,t=e.split()
 for y in range(int(s),int(t)+1):
  if((y%4==0)*(y%100!=0)or y%400==0):p(y);u=0
 if u:p('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: def isUruu(t):
    if t%4==0:
        if t%100==0:
            if t%400==0:return True
            return False
        return True
    return False

while 1:
    a,b=map(int,raw_input().split())
    if a==b==0:break
    cnt=0
    for i in xrange(a,b+1):
        if isUruu(i):
            print(i)
            cnt+=1
    if cnt==0:
        print('NA')
    print

Python: #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit


def main(readline=stdin.readline):
    leap_year = [not y % 4 and y % 100 or not y % 400 for y in range(3001)]
    while 1:
        a, b = (int(s) for s in readline().split())
        if not a and not b:
            exit()

        result = 'NA\n'
        for year, leap in enumerate(leap_year[a:b+1], a):
            if leap:
                print(year)
                result = ''

        print(result)


main()

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: while True:
 a,b=map(int,input().split())
 if a==b==0: break
 else:
  for i in range(a,b+1):
   if i%4==0 or i%400==0:
     print(i)
   elif i%100==0 or i != 0 and i%4>0:
     print("NA")

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

Python: while True:
    num = 0
    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: from calendar import isleap
f = lambda x: map(str, x) if x else ["NA"]
ans = []
while True:
    a, b = map(int, raw_input().split())
    if b == 0:
        break
    ans += f(filter(isleap, xrange(a, b+1))) + [""]
print("\n".join(ans).strip())

Python: b=0
for e in iter(input,'0 0'):
 if b:print()
 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:print(y);u=0
 if u:print('NA')

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 first:
        first = False
    else:
        print()

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

Python: # Aizu Problem 0093: Leap Yeark
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


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


first = True
while True:
    y1, y2 = [int(_) for _ in input().split()]
    if y1 == y2 == 0:
        break
    if first:
        first = False
    else:
        print()
    leap_years = [year for year in range(y1, y2 + 1) if is_leap_year(year)]
    if len(leap_years) == 0:
        print("NA")
    else:
        for year in leap_years:
            print(year)

Python: f = set(range(0,3000,4))
h = set(range(0,3000,100))
fh = set(range(0,3000,400))
lp = (f -h).union(fh)

while True:
  f,l = list(map(int, input().split()))
  if f == 0 and l == 0:
    break
  t = set(range(f,l+1))
  it = sorted(list(lp.intersection(t)))
  for y in t:
    print(y)
  if lent(it) == 0:
    print('NA')
  print (' ')

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: flag = False
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 flag:
        print('')
    flag = True
    if len(ans) != 0:
        for i in ans:
            print(i)
    else:
        print('NA')

Python: flag2 = False
while True:
    a,b = map(int, input().split())
    flag = True
    if b == 0:
        break
    if flag2:
        print()
    for y in range(a, b + 1):
        if y%4 == 0:
            if y%100 == 0:
                if y%400 == 0:
                    print(y)
                    flag = False
                    continue
                continue
            print(y)
            flag = False
    if flag:
        print("NA")
    flag2 = True

Python: p=print
b=1
for e in iter(input,'0 0'):
 b or p()
 b=f=0;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=1
 f or p('NA')

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: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("")