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>
int main(){
	int a, b;
	while(scanf("%d%d", &a, &b), a && b){
		int c = 0;
		for(;a<=b;a++){
			if(a % 4 == 0){
				if(a % 100){
					if(a % 400 == 0)c++, printf("%d\n", a);
				}
				else c++, printf("%d\n", a);
			}
		}
		if(!c)puts("NA");
	}
}

C++: #include <stdio.h>
#include <stdbool.h>

bool judge(int year)
{
    bool flag;
    if (year % 400 == 0) {
        flag = true;                
    } else if (year % 100 == 0) {
        flag = false;
    } else if (year % 4 == 0) {
        flag = true;
    }
    return flag;
}

int main(void)
{ 
    while (true) {
        int x, y;
        bool exist = false;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0) {
            break;
        }
        for (int i = x;i <= y; ++i) {
            bool flag = judge(i);
	    if (flag == true) {
                printf("%d\n", i);
                exist = true;
            }
        } 
        if (exist == 0) {
            printf("NA\n");
        }
        printf("\n");       
    }
    return 0;        
}

C++: #include<iostream>
#include<cstdio>
#include<vector>

using namespace std;

#define loop(i, a, b) for(int i = a; i < b; i++)

int main()
{
  int a, b;
  
  while(1) {
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    cout << endl;
    int cnt = 0;
    loop(i, a, b + 1) {
      if(i % 400 == 0) { cout << i << endl; cnt++; }
      else if(i % 100 && i % 4 == 0) { cout << i << endl; cnt++; }
    }
    if (!cnt)  cout << "NA" << endl;

  }
}

C++: #include <iostream>

using namespace std;

void solve()
{
	int a, b;
	while(cin >> a >> b, a || b)
	{
		bool ok = false;
		for(int i = a; i < b; ++i)
		{
			if((i % 4 == 0 && i % 100 != 0) || i % 400 == 0)
			{
				cout << i << endl;
				ok = true;
			}
		}

		if(!ok)
		{
			cout << "NA" << endl;
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <stdio.h>

int main(){

	int a,b;
	int i;
	int answer[1000];
	int count;

	while(1){
		count = 0;
		scanf("%d %d",&a,&b);

		if(a == 0 && b == 0){
			break;
		}

		for(i = a; i < b; i++){
			if(i % 4 == 0){
				if(i % 100 != 0 || i % 400 == 0){
					answer[count] = i;
					count ++;
				}
			}
		}

		for(i = 0; i < count; i++){
			printf("%d\n",answer[i]);
		}
		if(count == 0){
			printf("NA\n");
		}
	}

	return 0;
}

C++: #include <stdio.h>
#include <stdbool.h>

int get_leap_years(int *lys, int begin, int end);
bool is_leap_year(int y);

int main()
{
    int leap_years_list[1000];
    bool first_set = true;

    while (true) {
        int year_begin, year_end;
        //読み込み
        scanf("%d %d", &year_begin, &year_end);

        //終了判定
        if (year_begin == 0 && year_end == 0) {
            break;
        }

        //閏年を計算する
        int leap_years_count = get_leap_years(leap_years_list, year_begin, year_end);

        //セットとセットの間には空行を入れる
        if (first_set) {
            first_set = false;
        } else {
            putchar('\n'); //ちなみにputcharは一文字だけ出力する関数です
        }

        //セットの閏年を出力
        if (leap_years_count == 0) {
            puts("NA"); //putsは単純に与えられた文字列を出力した後改行する関数です
            continue;
        }
        for (int i = 0; i < leap_years_count; i++) {
            printf("%d\n", leap_years_list[i]);
        }
        
    }
}

int get_leap_years(int *lys, int begin, int end)
{
    int count = 0;
    for (int y = begin; y <= end; y++) {
        if (is_leap_year(y)) {
            lys[count++] = y;
        }
    }
    return count;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

bool is_uruu(int y) {
    return (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) ? true : false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll a,b;
    
    bool first=true;
    while(cin>>a>>b){
      if(a==0 && b==0) return 0;
      if(!first){      
        cout << endl;
      }

      VI V;
      FOR(i, a, b+1){
        if(is_uruu(i)) V.push_back(i);
      }

      if(V.size()==0){
        p("NA");
      }else{
        for(ll v : V){
          p(v);
        }
      }
      first = false;
    }
    
    return 0;
}