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>
using namespace std;

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

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

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

C++: #include<stdio.h>

void leap_year(int a, int b);

int main(void)
{
    while (1){
        int a, b;
        scanf("%d %d", &a, &b);
        if (a == 0 && b ==0) {
            break;
        } else {
            leap_year(a, b);
            printf("\n");
        }
    }
    return 0;
}

void leap_year(int a, int b)
{
    int count = 0;
    for (int i = a; i <= b; i++){
        if (i % 400 == 0) { //iが４００の倍数の時
            printf("%d\n", i);
            count = + 1;
        } else if (i % 100 != 0) { //iが100の倍数のでないとき  
            if ( i % 4 == 0) {//iが四の倍数のとき
                printf("%d\n", i);
                count = + 1;                
            }
        }
    }
    if (count == 0) { //閏年が0のとき        
        printf("NA\n");
    }     
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main() {
	int a, b;
	vector<int>aa;
	vector<int>bb;
	while (cin >> a >> b) {
		if (a == 0 && b == 0)break;
		aa.push_back(a);
		bb.push_back(b);
	}
	for (int i = 0; i != aa.size(); i++){
		bool b = false;
			for (int j = aa[i]; j <= bb[i]; j++){
			if (j % 4 == 0) 
				if (j % 100 == 0) {
					if (j % 400 == 0) {
						b = true;
						cout << j << endl;
					}
				}
				else {
					b = true;
					cout << j << endl; 
				}
				if (b == false)cout << "NA\n";
		}
		cout << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){

  int a,b,c=0;

  while(true){
    
    cin>>a>>b;
    if(a==0&&b==0) break;
    if(c!=0)cout<<endl;


    vector<int> leaps;

    if(a%4!=0)
      a = 4 - a%4 + a;

    for(int i=a;i<=b;i+=4){
      if(i%400==0){
        cout<<i<<endl;
        leaps.emplace_back(i);
      }else if(i%100==0){
        continue;
      }else{
        cout<<i<<endl;
        leaps.emplace_back(i);
      }
    }

next : 

    if(leaps.size()==0) cout<<"NA"<<endl;
    ++c;

  }

  return EXIT_SUCCESS;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main() {
	bool leap[3000];
	rep(i, 3000) {
		if (i % 4 == 0 && (i % 100 != 0 || i % 400 == 0)) leap[i] = true;
		else leap[i] = false;
	}
	for (int a, b; cin >> a >> b, (a | b) != 0; ) {
		bool exist = false;
		REP(i, a, b) {
			if (leap[i]) {
				cout << i << endl;
				exist = true;
			}
		}
		if (!exist) cout << "NA" << endl;
		cout << endl;
	}
	
	return 0;
}

C++: #include <iostream>

bool judgeUruyear(int year)
{

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

}

//int flag = 0;

void printUruyear(int year_begin, int year_end)
{

  //  if(flag == 1){
        std::cout << std::endl;
    //}
    flag = 1;

    int count_year = 0;

    // kono for loop no jyouken-siki ha "=" hituyou
    for (int i = year_begin; i <= year_end; i++) {
        
        if (judgeUruyear(i)) {

            count_year += 1;
            std::cout << i << std::endl;
        }    
    }

    if (count_year == 0) { 
        std::cout << "NA" << std::endl;
    }
    
}

int main()
{
    int year_begin, year_end;

    while (true) {

        std::cin >> year_begin >> year_end;

        if (year_begin == 0 && year_end == 0) {
            break;
        }

        printUruyear(year_begin, year_end);
    }
    
    return 0;
}

// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=1877346#1

C++: #include<cstdio>
#include<iostream>
using namespace std;
main(){
  int a,b,n[3001],i,l;
  while(1){
    cin >> a >> b;
    if(a==0 && b==0){
      break;
    }
    l=0;
    for(i=a;i<=b;i++){
      if(i%400==0){
	n[l]=i;
	l++;
      }
      else if(i%100!=0 && i%4==0){
	n[l]=i;
	l++;
      }
    }
    if(l==0){
      cout << "NA" << endl;
    }
    else{
      for(i=0;i<l;i++){
	cout << n[i] << endl;
      }
    }
  }
}

C++: //↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

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