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,x=0;
	while(cin>>a>>b){
		int c=0;
		if(a==0 && b==0) break;
		if(x==1) cout<<endl;
		for(int i=a;i<=b;i++){
			if(i%4==0){
				if(i%100==0){
					if(i%400==0){
						cout<<i<<endl;
						c++;
					}else{
						continue;
					}
				}else{
					cout<<i<<endl;
					c++;
				}	
			}
		}
		if(c==0) cout<<"NA"<<endl;
		int x=1;
	}
	return 0;
}

C++: #include <stdio.h>
#include <algorithm>
using namespace std;

int main() {
  int a, b;
  bool first = true;
  while (scanf("%d %d", &a, &b), a|b) {
    if (!first) { puts(""); }
    first = false;
    if (a > b) { swap(a, b); }
    bool output = false;
    for (int i = a; i <= b; i++) {
      if (i % 400 == 0 || (i % 100 != 0 && i % 4 == 0)) {
        output = true;
        printf("%d\n", i);
      }
    }
    if (!output) { puts("NA"); }
  }
}

C++: #include<iostream>

using namespace std;

int main(void){
	while( true ){
		int a, b;
		bool bFound = false;

		cin >> a >> b;
		if( a==0 && b==0 ) break;

		for(int i = a; i <= b; i++){
			if( i % 4 == 0 && (i % 100 != 0 || i % 400 == 0)){
				bFound = true;
				cout << i << '\n';
			}
		}
		if( !bFound ) cout << "NA\n";
		cout << endl;
	}
	return 0;
}

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

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

C++: 
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int main(void){
  int b,e;
  bool fa=false;
  while(cin >> b >> e , b+e){
    if(fa)cout<<endl;
    bool na=false;
    loop(i,b,e){
      if(!i%400){
	cout<< i << endl;
	count++;
      }
      if(i%100 && !i%4){
	cout<<i<<endl;
	na=true;
      }
    }
    na?cout<<"NA"<<endl:;
  }

}

C++: #include <stdio.h>

int hantei(int year);
//???????????´????????????????????????????????????

int main(void)
{
	int year[2];
	int NA = -1;
	int leapyear[3000];
	for(int i = 0; i < 3000; i++) {
		leapyear[i] = hantei(i);
	}
	for(;;) {
		scanf("%d %d", &year[0], &year[1]);
		if(year[0] == 0 && year[1] == 0) {
			break;
		}else if(NA != -1) {
			printf("\n");
		}
		NA = 0;
		for(int i = year[0]; i <= year[1]; i++) {
			if(leapyear[i] == 1) {
				printf("%d\n", i);
				NA++;
			}
		}
		if(NA == 0) {
			printf("NA\n");
		}
	}
	return 0;
}

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

C++: #include <stdio.h>

void leap_year(int year);
int leap_year_judge(int year_a, int year_b);

int main(void)
{
	int year_a, year_b, exist;
	while (1) {
		scanf("%d %d", &year_a, &year_b);
		exist = leap_year_judge(year_a, year_b);
		if (year_a == 0 && year_b == 0){
			break;
		} else if (exist == 1){
			for (int i = year_a; i <= year_b; i++) {
				leap_year(i);
			}
		} else {
			printf("\nNA\n");
		}
		
	}
	return 0;
}

void leap_year(int year)
{
	if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
		printf("%d\n", year);
	} 
}

int leap_year_judge(int year_a, int year_b)
{
	int judge = 0;
	for (int i = year_a; i <= year_b; i++) {
		if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
			judge = 1;
		} 
	}
	return judge;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int fiyear,finyear,co=0;
    while(cin>>fiyear>>finyear&&fiyear!=0&&finyear!=0){
        for(int i=0;(fiyear+i)=<finyear;i++){
            if((fiyear+i)%4==0){
                co=1;
                if((fiyear+i)%100!=0||(fiyear+i)%400==0)cout<<fiyear+i<<endl;
            }
        }
        if(co==0)cout<<"NA"<<endl;
        cout<<endl;
    }
}

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

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	int a,b;
	int x=0;
	while(true){
		cin>>a>>b;
		if(a+b==0) break;
		for(int i=a;i<=b;i++){
			if((i%4==0&&i%100!=0)||i%400==0){
				printf("%d\n",i);
				x++;
			}
			if(i==b&&x==0){
				printf("%s\n","NA");
			}
		}
		x=0;
		cout<<endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  int a,b;
  int ans=0,c=0,h=0;
  while(cin>>a>>b){
    if(a==0&&b==0) break;
    if(c!=0) cout << endl;
    for(int i=a;i<=b;i++){
      if(i%4==0){
	if(i%100==0){
	  if(i%400==0){
	    ans = i;
	  }
	  if(ans==0) continue;
	}
	ans = i;
      }
      else continue;
      cout << ans << endl;
    }
    if(ans==0) cout << "NA" << endl;
    ans = 0;
    c++;
  }
  return 0;
}

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

int main(){
    int A=-1,B=-1;
    while(cin>>A>>B, A||B){
        if(~A || ~B) puts("");
        bool no = true;
        for(int i=A;i<=B;i++){
            if(i%4==0 && (i%100!=0 || i%400==0)) printf("%d\n",i), no = false;
        }
        if(no) puts("NA");
    }
    return 0;
}

C++: #include <iostream>



bool judge(int year);

int main() 
{
	int start, end;
	
	while (true) {
		int check = 0;
		std::cin >> start >> end;
		
		
		if (start == 0 && end == 0) {
			break;
		}
		
		std::cout << std::endl;
		
		for (int i = start; i <= end; i++) {
			if (judge(i)) {
				std::cout << i << std::endl;
				check = 1;
			}
		}
		
		if (check == 0) {
			std::cout << "NA" << std::endl;
		}
		
	}
	return 0;
}


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