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 <algorithm>

using namespace std;

bool check(int year)
{
  if(year%400 == 0 || (year%4 == 0 && year%100 != 0))
    return true;

  return false;
}

int main()
{
  int a, b;
  bool flg = false;

  while(cin>>a>>b && a+b){
    if(flg) cout << endl;

    flg = false;
    for(int year = a; year <= b; ++year){
      if(check(year)){
	cout << year << endl;
	flg = true;
      }
    }

    if(!flg) cout << "NA" << endl;
    flg = true;
  }
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;


signed main(){
  int a,b;
  while(cin>>a>>b,a){
    vector<int> y;
    for(int i=a;i<=b;i++){
      if(i%4==0){
        if(i%100!=0){
          y.PB(i);
          continue;
        }
        if(i%400==0)y.PB(i);
      }
    }
    if(y.size()==0){
      cout<<"NA"<<endl;
    }else{
      for(auto x:y)cout<<x<<endl;
    }
    cout<<endl;
  }
  return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>

using namespace std;
using LL = long long;

constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;

int main() {
	int a, b;
	bool c = false;
	while (cin >> a >> b&&(a||b)) {
		if (c)cout << endl;
		c = true;
		int count = 0;
		for (int i = a; i <= b; i++) {
			if (i % 4 == 0) {
				if (i % 100 != 0) {
					cout << i << endl;
					count++;
				}
				else {
					if (i % 400 == 0) {
						cout << i << endl;
						count++;
					}
				}
			}
		}
		if (count == 0) {
			cout << "NA" << endl;
		}
	}
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int hoge[1010];

int main() {
	int n,m;
	while(n=in(),m=in()){
		int i;bool na=true;
		for(i=n;i<=m;i++){
			if(i%4?false:i%100?true:i%400?false:true){
				cout<<i<<endl;
				na=false;
			}
		}
		if(na)cout<<"NA\n";
		cout<<endl;
	}
	return 0;
}

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

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

int main(){
	int a, b;
	int n = 0;
	while(cin >> a >> b){
		if(a == 0 && b == 0) break;
		if(n != 0) cout << endl;
		else n++;
		int uru[1000];
		int count = 0;
		for(int i = a; i <= b; i++){
			if(is_uruu(i)){
				uru[count++] = i;
			}
		}
		if(count == 0){
			cout << "NA" << endl;
		} else {
			for(int j = 0; j < count; j++)
				cout << uru[j] << endl;
		}
	}
	return 0;
}

C++: #include<stdio.h>
    
int leap_year(int x);
        
int main(void)
{
    int start_year, end_year, counter;
    while(1){
        scanf("%d %d", &start_year, &end_year);
        if(start_year == 0 && end_year == 0){
            break;
        }else{
            counter = 0;
            for(int i = start_year; i <= end_year; i++){
                counter += leap_year(i); 
                }
            if( counter == 0){
                printf("NA\n");
            }
        }
    }
    return 0;
}
    
    
int leap_year(int x)
{
    if((x % 4 == 0 && !(x % 100 == 0)) || x % 400 == 0){
        printf("%d\n", x);
        printf("\r\n");
        return 1;
    }
    return 0;
}

C++: #include <stdio.h>
	
int uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if ((i % 400 != 0 && i % 100 == 0 && i - first <= 3 && end - i <= 3) || (first == end)) {
			printf("NA\n");
			count = count + 1;		
		}
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		}else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n")
	}
}
	
int main(void)
{	
	while (1) {
		static int first, end;
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			printf("\n");
		}
	}
}

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

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main()
{
	bool first=true;
	for(int a,b;cin>>a>>b,a|b;){
		cout<<(first?"":"\n");
		first=false;
		
		ostringstream oss;
		repi(i,a,b+1)
			if(i%400==0 || i%4==0 && i%100)
				oss<<i<<endl;
		if(oss.str().size())
			cout<<oss.str();
		else
			cout<<"NA"<<endl;
	}
	
	return 0;
}

C++: #include <stdio.h>
	
void uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
}
	
int main(void)
{	
	int first, end, dataset;
	dataset = 0;
	while (1) {
		if (dataset != 0) {
		printf("\n");
		}
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			dataset = dataset++;
		}
		if (scanf("%d %d", &first, &end) == EOF) {
			printf("\n");
		}
	}
	return 0;
}