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 <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	int a, b;
	for(int i=0; scanf("%d%d", &a, &b), a&b; ++i){
		bool output = false;
		if(i)
			puts("");

		reep(j, a, b){
			if(j%4==0 && (j%100!=0 || j%400==0)){
				printf("%d\n", j);
				output = true;
			}
		}

		if(!output)
			puts("NA");
	}

	return 0;
}

C++: #include <iostream>


int leap_year(int y) {
	if( y % 400 == 0) {
		return 1;/*???????????´*/
	} else if (y % 100 == 0 && y % 400 != 0) {
		return 0;/*???????????´??§??????*/
	} else if (y % 4 == 0 && y % 100 != 0) {
		return 1;
	} else {
		return 0;
	}
}
int main()
{
	int a, b;
	int n =0;/*???????????°-1*/
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			if (n >0) {
				std::cout << std::endl;/*1?????????????????\?????§??????????????????*/
			}
			int sum = 0;
			for (int k = a; k <= b; k++) {
				sum = sum + leap_year(k);
			}
			if (sum == 0 /*????????????????????´?????????*/) {
				std::cout << "NA" << std::endl;
			} else {
			    for (int i =a; i <= b; i++) {
					if (leap_year(i) == 1) {
						std::cout << i << std::endl;
					}
				}
			}
		}
	n++;
	}
	return 0;
}

C++: #include <stdio.h>

void leap_year(int start, int end)
{
    int y = 0;
    for (int x = start; x <= end; ++x) {
        if (x % 4 == 0 && (x % 100 != 0 || x % 400 == 0)) {
            printf("%d\n", x);
            ++y;
        }
    }
    if (y == 0) {
        printf("NA\n");
    }
    }
        
int main(void)
{
    while (1) {
        int start, end;
        scanf("%d %d", &start, &end);
        if (start == 0 && end == 0) {
            break;
        } else {
            leap_year(start, end);
        }
    }
    return 0;
}

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

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

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int a, b;
  VI y;

  cin >> a >> b;
  while(1) {
    for(int i = a; i < b; i++) {
      if(i % 400 == 0) y.PB(i);
      else if(i % 100 == 0) continue;
      else if(i % 4 == 0) y.PB(i);
    }

    if(y.empty()) cout << "NA" << endl;
    else {
      VI::iterator it = y.begin();
      while(it != y.end()) {
	cout << *it << endl;
	it++;
      }
    }
    y.clear();

    cin >> a >> b;
    if(a+b == 0)break;
    cout << '\n';
  }
}

C++: #include <iostream>
using namespace std;
int main(){
	int a,b; int count=0;
	while(1){
		cin >> a >> b ;
		if(a==0 && b==0) break;
		if(count++) cout << '\n' ;
		int* ans=new int[(b-a+1)/4];int n=0;
		for(int i=a;i<=b;i++) if((i%4==0 && i%100!=0) || i%400==0) ans[n++]=i;
		if(n==0) cout << "NA\n" ;
		else for(int j=0;j<n;j++) cout << ans[j] << '\n';
	};
}

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

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

int main(){
  int a,b;
  bool f,g;

  g = true;
  while(1){
    cin >> a >> b;
    if(!a && !b)break;

    if(!g)cout << endl;

    f = false;
    for(int i=a;i<=b;i++){
      if( !(i%400) ){
	cout << i << endl;
	f = true;
      }else if( !(i%100) ){
      }else if( !(i%4) ){
	cout << i << endl;
	f = true;
      }
    }
    if(!f)cout << "NA" << endl;
    g = false;
  }
}

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

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

int main(void)
{
  int a, b;
  int flag;
  int flag2=0;
  
  while(1)
    {
      cin >> a >> b;
      if(a == 0 && b == 0) break;
      flag = 0;
      if(flag2 != 0)cout << endl;

      for(int i = a ; i <= b ; i++)
	{
	  if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0) 
	    {
	      cout << i << endl;
	      flag = 1;
	    }
	}
      if(flag == 0) cout << "NA" << endl;
      flag2 = 1;
    }
  return 0;
}