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

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	int n,m;
	while(cin>>n>>m,n||m){
		bool flag =false;
		for(int i=n;i <=m;i++){
			if(i%400==0){
				flag =true;
				cout <<i<<endl;
				continue;
			}
			if(i%4==0&&i%100!=0){
				flag =true;
				cout <<i<<endl;
			}
		}
		if(!flag){
			cout <<"NA"<<endl;
		}
		cout <<endl;
	}
	return 0;
}

C++: #include<stdio.h>

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

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

int main(void)
{
	int a, b;
	bool x = true;
	
	while (1){
		scanf("%d %d", &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){
				printf("%d\n", i);
				x = false;
			}
		}
		if (x == true){
			printf("NA");
		}
		x = true;
	}
	
	return (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()
{
	for(int a,b;cin>>a>>b,a|b;){
		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;
		cout<<endl;
	}
	
	return 0;
}

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);
      if (start_year == 0 && end_year == 0) {
        break;
      } else {exist = existance_leap_year(start_year, end_year);
        if (exist == 1) {
          printf("\n");
          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>

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

int main(void)
{
    int year, from, until, num_leap_year;
    while (1) {
        num_leap_year = 0;
        scanf("%d %d", &from, &until);
        printf("\n");
        if (from == 0 && until == 0) {
            break;
        }
        for (year = from; year <= until; year++) {
            if (isLeapYear(year) == true) {
                num_leap_year++;
                printf("%d\n", year);
            }
        }
        if (num_leap_year == 0) {
            printf("NA\n");
        }
    }
    return 0;
}

C++: #include <stdio.h>
#include <stdbool.h>


void leapyear (int year1, int year2)
{
    int i;
    int j = 0; 
    for (i = year1; i <= year2; ++i) {
        if (i % 4 == 0) {
            if (i % 100 != 0) {
                printf("\n");
                printf("%d\n", i);
                ++j;
            } else if (i % 400 == 0) {
                printf("\n");
                printf("%d\n", i);
                ++j;
            } 
        }
    }
    if (j == 0) {
        printf("NA\n");
    }
    printf("\n");
}

int main(void)
{
    while (true) {
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        leapyear(year1, year2);
    }
    return 0;
}

C++: #include <stdio.h>

int main(void)
{
    int a, b, year, answer;
    while(1) {
	scanf("%d %d", &a, &b);
	if (a == 0 && b == 0) {
	    break;
	}
	answer = 0;
	for (year = a; year <= b; year++) {
	    if (year % 4 == 0) {
		if (year % 100 != 0) {
		    answer++;
		} else {
		    if (year % 400 == 0) {
			answer++;
		    }
		}
	    }
	}
	if (answer != 0) {
    	    printf("%d\n", answer);
	} else {
	    printf("NA\n");
	}
    }
    return 0;
}

C++: #include <stdio.h>

int main(void) {

  int a,b;
  int i,flag;

  while(1) {

    scanf("%d %d",&a,&b);

    if(a==0 && b==0) {
      return 0;
    }

    flag=0;

    for(i=a;i<=b;i++) {
      
      if((i%4==0 && i%100!=0) || i%400==0) {
	printf("%d\n",i);
	flag=1;
      }

    }

    if(flag==0) printf("NA\n");

    printf("\n");
  }

  return 0;

}