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: 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):((y%4==0)*(y%100!=0)or y%400==0)and print(y);u=0
 if u:print('NA')

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 and y%100!=0 or y%400==0:print(y);u=0
 if u:print('NA')

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

Python: 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')

Python: def isUruu(t):
    if t%4==0:
        if t%100==0:
            if t%400==0:return True
            return False
        return True
    return False
n=0
while 1:
    n+=1
    a,b=map(int,raw_input().split())
    if a!=0 and b!=0 and n!=1:print
    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')

Python: jun = 0
while True:
    num = 0
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        break
    if jun > 0:
        print()
    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")
    jun += 1

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

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

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

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

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

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: def isLeap(y):
    return y % 4 == 0 and (y != 100 or y == 400)

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: from calender import isleap

while True:
    a, b = map(int, input().split())
    if a == 0:
        break
    print(sum(isleap(i) for i in range(a, b+1)))

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)]
    separator = ''
    while 1:
        a, b = (int(s) for s in readline().split())
        if not a and not b:
            exit()

        print(separator, end='')

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

        print(result, end='')
        separator = '\n'


main()

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]
for _ in stdin.readlines() :
    a, b = map(int, _.split())
    if a == b == 0 : break
    make(a, b)
    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):
            if y != a:
                print()
            found = True
            print(y)
    if not found:
        print('NA')

Python: import sys
f = sys.stdin

def is_leapyear(year):
    return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
i = 0
while True:
    a, b = map(int, f.readline().split())
    if a == b == 0:
        break
    if i:
        print()
    leapyear = [year for year in range(a, b + 1) if is_leapyear(year)]
    print('\n'.join(map(str, leapyear)) if leapyear else 'NA')
    i += 1

Python: for e in iter(input,'0 0'):
 s,t=map(int,e.split())
 u=[y for y in range(s+1,t)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
    print(sum(isleap(i) for i in range(a, b+1)))

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: from calendar import isleap

flag = False
while True:
    a, b = 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")

Python: first=1
while 1:
    a,b=map(int,input().split())
    if a==b==0:break
    if first==1:
        first=0
    else:
        print()
    count=0
    for i in range(a,b+1):
        if i%400==0:
            print(i)
            count+=1
        elif i%100==0:
            pass
        elif i%4==0:
            print(i)
            count+=1
    if count==0:print("NA")

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 != a:
            print()
        if y % 4 == 0 and (y % 100 != 0 or y % 400 == 0):
            found = True
            print(y)
    if not found:
        print('NA')

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):y%4==0 and y%100!=0 or y%400==0 and print(y);u=0
 if u:print('NA')