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 <stdio.h>

void print_na(int a, int b);
void leap_year(int a, int b);

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

void print_na(int a, int b)
{
    for (int i = a; i <= b; i++) {
        if ((i % 4 == 0 && !(i % 100 == 0)) || i % 400 == 0) {
            return;
        }
    }
    printf("NA\n");
}

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

C++: #include <stdio.h>

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

int main(void)
{
	int year[2];
	int NA;
    printf("\n");
	for(;;) {
		scanf("%d %d", &year[0], &year[1]);
		if(year[0] == 0 && year[1] == 0) {
			break;
		}
		NA = 0;
		for(int i = year[0]; i <= year[1]; i++) {
			if(hantei(i) == 1) {
			printf("%d\n", i);
			NA++;
			}
		}
		if(NA == 0) {
			printf("NA\n");
		}
		printf("\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 <iostream>
using namespace std;

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

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

int main(){
    int a, b;
    bool flag=false;
    bool ini=false;
    while(cin >> a >> b, a != 0 && b != 0){
        flag = false;
        if(ini)cout << endl;
        else ini = true;
        for(int y = a; y<=b; y++){
            if(y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)){
                flag = true;
                cout << y << endl;
            }
        }

        if(!flag){
            cout << "NA" << endl;
        }
    }

    return 0;
}

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

int main(){
	int a,b,t=0;

	while(++t){
		vector<int> leap;
		cin>>a>>b;
		
		if(a==0&&b==0) break;
		if(t>1) cout<<endl;

		for(int i=a;i<=b;i++){
			if( i%400==0 || (i%4==0 && i%100!=0)) leap.push_back(i);
		}

		if(leap.size()==0){
			cout<<"NA"<<endl;
		}
		else{
			for(int i=0;i<leap.size();i++){
				cout<<leap[i]<<endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>

bool judge_uruyear(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;
    }
}

void print_uruyear(int year_begin, int year_end)
{
    int count_year = 0;
    for(int i = year_begin; i < year_end; i++) {
        if (judge_uruyear(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;
    std::cin >> year_begin >> year_end;

    while(year_begin != 0 || year_end != 0) {
        
        print_uruyear(year_begin, year_end);

    }
    
    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) {
      goto Exit;
    }

    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");
  }

 Exit:
  return 0;

}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define INF 100000000
typedef long long ll;

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

C++: #include <iostream>

bool judge_uruyear(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;
    }
}

void print_uruyear(int year_begin, int year_end)
{
    int count_year;
    for(int i = year_begin; i < year_end; i++) {
        if (judge_uruyear(i)) {
            std::cout << i << std::endl;
        }
        if(count_year == 0) {
            std::cout << "NA" << std::endl;
        }
    }
}

int main()
{
    int year_begin, year_end;
    std::cin >> year_begin >> year_end;

    while(year_begin != 0 && year_end != 0) {
        
        print_uruyear(year_begin, year_end);

    }
    
    return 0;
}

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

C++: #include <iostream>

using namespace std;

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

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+1){
			if(j%4==0 && (j%100!=0 || j%400==0)){
				printf("%d\n", j);
				output = true;
			}
		}

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

	return 0;
}