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 <bits/stdc++.h>                                             
                                                                     
using namespace std;                                                 
                                                                     
int main() {                                                         
                                                                     
    int a, b, isNA;                                                  
                                                                     
    while(cin >> a >> b && (a || b)) {                               
                                                                     
        isNA = 1;                                                    
                                                                     
        for(int i = a; i <= b; ++i) {                                
            if(i == 0) {                                             
                continue;                                            
            }                                                        
            if(i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {       
                cout << i << endl;                                   
                isNA = 0;                                            
            }                                                        
        }                                                            
                                                                     
        if(isNA == 1) {                                              
            cout << "NA" << endl;                                    
        }                                                            
                                                                     
    }                                                                
                                                                     
}

C++: #include <stdio.h>

void judge_leap_year(int a, int b);

int existance_leap_year(int a, int b);

int main(void)
{
    while(1) {
      int exist;
      int start_year, end_year;
      scanf("%d %d", &start_year, &end_year);
      printf("\n");
      if (start_year == 0 && end_year == 0) {
        break;
      } else {exist = existance_leap_year(start_year, end_year);
        if (exist == 1) {
          judge_leap_year(start_year, end_year);
        } else {
          printf("NA\n");
        }
      }
    printf("\n");
    }
    return 0;
}

void judge_leap_year(int a, int b)
{
      int year;
      for (year = a; year <= b; year++) {
        if (year % 400 == 0) {
          printf("%d\n", year);
        } else if (year % 4 == 0 && year % 100 != 0) {
          printf("%d\n", year);
        }
      }
}
//閏年を記述する                                                                                                                                                                     

int existance_leap_year(int a, int b)
{
    int n = 0;
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        n = 1;
        break;
      } else if (year % 4 == 0 && year % 100 != 0) {
        n = 1;
        break;//一度閏年を検出した時点でループを抜ける。                                                                                                                             
      }
    }
    return n;
}
//閏年があった時、１を返す

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

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

C++: #include<stdio.h>
int main(void)
{
	int a,s,d,i,f;
	f=0;
	scanf("%d %d",&a,&s);
	while(a!=0&&s!=0){
	d=0;
	if(f!=0){
		printf("\n");
	}
	for(i=a;i<=s;i++){
		if(i%4==0&&i%100!=0||i%400==0){
			printf("%d\n",i);
			d=1;
		}
	}
	if(d==0){
		printf("NA\n");
	}
	scanf("%d %d",&a,&s);
	f++;
	}
	return 0;
}

C++: #include <iostream>

int leap_year(int year)
{
	if ( year % 4 == 0) {
		if ( year % 100 == 0) {
			if ( year % 400 == 0) {
				return 1;
			} else {
				return 0;
			}
		} else {
			return 1;
		}
	} else {
		return 0;
	}
}

int main()
{
	int a, b;
	int first = 0;
	while (true) {
		std::cin >> a >> b;
		std::cout << std::endl;
		if (a == 0 && b == 0) {
			break;
		}
		if (first != 0) {
			std::cout << std::endl;
		}
		first = 1;
		int i = 0;
		for (int j = a; j <= b; j++) {
			if (leap_year(j) == 0) {
				i++;
			} else {
				std::cout << j << std::endl;
			}
		}
		if ( i == a - b + 1) {
			std::cout << "NA" << std::endl;
		}
	}
}

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

int main()
{
	int a, b;
	bool x = true, y = false;
	
	while (1){
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0){
			break;
		}
		if (y){
			printf("\n");
		}
		y = true;
		
		for (int i = a; i <= b; i++){
			if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
				printf("%d\n", i);
				x = false;
			}
		}
		if (x == true){
			printf("NA\n");
		}
		x = true;
	}
	
	return (0);
}

C++: #include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int a, b;
	while (cin >> a >> b, a) {
		bool na = true;
		range (i, a, b + 1) {
			if (i % 4 == 0) {
				if (i % 400 == 0) {
					na = false;
					cout << i << endl;
				}
				else if (i % 100 != 0) {
					na = false;
					cout << i << endl;
				}
			}
		}
		if (na) cout << "NA" << endl;
		cout << endl;
	}
	return 0;
}