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++
	}

}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;
 
#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999
 
#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
 
typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;
 
typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;
 
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;
 
namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}
 
int main() {
    int a,b;
    bool first = true;
    while(cin >> a >> b) {
        if(a == 0 && b == 0) break;
        if(!first) cout << endl;
        first = false;
        vector<int> ans;
        rep(i,a,b+1) {
            if(i % 400 == 0) ans.pb(i);
            else if(i % 100 != 0 && i % 4 == 0) ans.pb(i);
        }
        if(ans.empty()) cout << "NA" << endl;
        else {
            rep(i,0,ans.size()) cout << ans[i] << endl;
        }
    }
    return 0;
}

C++: #include <stdio.h>
void leapmaker(int start, int end);
int main(void){
    int Year1 = -1, Year2 = -1;
    while(1)
    {
        if(!(Year1 == -1 && Year2 == -1))
        {
            printf("\n");
        }
        scanf("%d %d", &Year1, &Year2);
        if (Year1 == 0 && Year2 == 0)
        {
            break;
        }

        leapmaker(Year1, Year2);
    }
    return 0;
}
void leapmaker(int start, int end){
    int naflag = 1;
    for(int i = start - start % 4; i <= end; i += 4){
        if (i >= start) if (i % 100 == 0)
        {
            if (i % 400 == 0)
            {
                printf("%d\n", i);
                naflag = 0;
            }
        } else {
            naflag = 0;
            printf("%d\n", i);
        }
    }
    if (naflag == 1)
    {
        printf("NA\n");
    }
}

C++: #include <stdio.h>

void leap(int start, int end);

int main(void)
{
    int start, end;
    while (1){
        scanf("%d %d", &start, &end);
        if (start == 0 && end == 0){
            break;
        } else {
            leap(start, end);
        }
    }

    return 0;
}

void leap(int start, int end)
{
    static int first_output = 1;
    if (first_output != 1){
        printf("\n");
    }
    first_output = 0;

    int cnt = 0;
    for (int year = start; year <= end; year++){
        if (year % 4 == 0 && year % 100 != 0){
            printf("%d\n", year);
            cnt++;
        }
        if (year % 400 == 0){
            printf("%d\n", year);
            cnt++;
        }
    }
    if (cnt == 0){
        printf("NA\n");
    }
}

C++: #include<iostream>
using namespace std;
int main(){
	int a, b, i;
	bool flg;
	while(true){
		cin>>a>>b; if(a==0 && b==0) break;
		flg=false;
		for(i=a;i<=b;i++){
			if(i%400 == 0){
				cout<<i<<endl;
				flg=true;
			}else if(i%100 == 0){
			}else if(i%4 == 0){
				cout<<i<<endl;
				flg=true;
			}
		}
		if(flg==false) cout<<"NA\n";
		cout<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>

#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to, weight;

	bool operator < (const Edge& obj) const {
		return weight < obj.weight;
	}
	bool operator > (const Edge& obj) const {
		return weight > obj.weight;
	}
};

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //????????\??£??????????????¨ y?????\??£?????????????????????
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //x??¨y????????????????????\??£??????????????????????????????
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int arr[100001];
void Eratosthenes(int N) {//N?????§????´???°??¨
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = i * 2; j <= N; j += i) {
				arr[j] = 0;
			}
		}
	}
}

int main()
{
	int fas = true;
	while (1) {
		if (!fas) cout << endl;
	int a, b;
	cin >> a >> b;

	if (a == 0 && b == 0) break;
	bool f = false;
	rep(i, a, b + 1) {
		if ((i % 4) == 0 && i % 100) f = 1, cout << i << endl;
		else if ((i % 400) == 0) f = 1, cout << i << endl;
	}
	if(!f)cout << "NA";
	fas = false;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

bool is_leap( int y )
{
	if ( y % 4 == 0 )
	{
		if ( y % 100 == 0 )
		{
			if ( y % 400 == 0 )
			{
				return true;
			}
		}
		else
		{
			return true;
		}
	}
	return false;
}

int main( void )
{
	bool f = false;
	int a, b;
	while ( cin >> a >> b && a && b )
	{
		if ( f ) cout << endl;
		else f = true;

		bool exist = false;
		for ( int i = max(0,a); i <= min(3000,b); i++ )
		{
			if ( is_leap( i ) )
			{
				cout << i << endl;
				exist = true;
			}
		}

		if ( exist == false )
			cout << "NA" << endl;

	}
	return 0;
}