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>
#include <stdbool.h>

bool is_leap_year(int y);

int get_leap_years(int* leap_year_array, int start_year, int final_year);
int main()
{
    int leap_years_list[1000]; //A.D. 0 - A.D. 3000 の間に閏年は高々1000個しかない

    bool first_set = true; //一つ目のセットの前にだけは改行を入れてはいけないので

    while (true) {
        int year_begin, year_end;

        //読み込み
        scanf("%d %d", &year_begin, &year_end);

        //終了判定
        if (year_begin == 0 && year_end == 0) {
            break;
        }

        //閏年を計算する
        int leap_years_count = get_leap_years(leap_years_list, year_begin, year_end);

        //セットとセットの間には空行を入れる
        if (first_set) {
            first_set = false;
        } else {
            putchar('\n'); //putcharは一文字だけ出力する関数です
        }

        //閏年を出力
        if (leap_years_count == 0) {
            puts("NA"); //putsは与えられた文字列を出力した後改行する関数です
        } else {
            for (int i = 0; i < leap_years_count; i++) {
                printf("%d\n", leap_years_list[i]);
            }
        }
        
    }
}

bool is_leap_year(int y)
{
    if (y % 400 == 0) {
        return true; 
    } else if (y % 100 == 0) {
        return false;
    } else {
        return y % 4 == 0;
    }
}

int get_leap_years(int* leap_year_array, int start_year, int final_year)
{
    int count = 0;
    for(int i = start_year; i <= final_year; i++){
        if(is_leap_year(i)){
            leap_year_array[count] = i;
            count++;
        }    
    }
    count++; 
    return count;
}

C++: #include <stdio.h>
	
int uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) 
	{	
		if (i % 400 == 0) {
		    count = count + 1;
			printf("%d\n", i);
		} else if (i % 100 == 0) {
			i = i + 3;
		}else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
}
	
int main(void)
{	
	while (1) {
		static int first, end;
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			printf("\n");
		}
	}
}

C++: #include <bits/stdc++.h>

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

/*int main() {
  string a;
  cin >> a;
  string s = "";
  for (int i = 0; i < 10; i++) {
    s += a[i];
  }
  for (int i = 0; i < 44; i++) {
    int t = s[0 + i] - '0';
    int u = s[1 + i] - '0';
    s += (t + u) % 10 + '0';
  }
  cout << s[54] << endl;
  return 0;
}*/
int main() {
  int a, b;
  int p = 1;
  while (cin >> a >> b && a != 0 && b != 0) {
    if (p) {
      cout << endl;
      p = 0;
    }
    int flag = 1;
    for (int i = a; i <= b; i++) {
      if (i % 100 == 0 && i % 400 != 0) {
        // continue;
      } else if (i % 4 == 0 && i % 100 != 0) {
        cout << i << endl;
        flag = 0;
      } else if (i % 400 == 0) {
        cout << i << endl;
        flag = 0;
      } else {
        // continue;
      }
    }
    if (flag) {
      cout << "NA" << endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int a, b;
bool isUruu(int year) {
    return((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}

void solve() {
    bool update = false;
    for(int r = a+1; r < b; r++) {
        if(isUruu(r)){ cout << r << endl; update = true; }
    }
    if(!update) cout << "NA" << endl;
}

int main(void) {
    while(cin >> a >> b, a|b) {
        solve();
    }
    return(0);
}

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

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int>aa;
vector<int>bb;
int main() {
	int a, b;
	while (cin >> a >> b) {
		if (a == 0 && b == 0)break;
		aa.push_back(a);
		bb.push_back(b);
	}
	for (int i = 0; i != aa.size(); i++){
		if (bb[i] - aa[i] < 4) {
			cout << "NA" << endl;
			goto U;
		}
		for (int j = aa[i]; j <= bb[i]; j++){
			if (j % 4 == 0) {
				if (j % 100 == 0){
					if (j % 400 == 0){
						cout << j << endl;
					}
				}
				else cout << j << endl;
			}
		}
	U:cout << endl;
	}
	char c;
	cin >> c;
}

C++: #include<stdio.h>

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

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

int uruu(int i){
  if(i%4!=0)return 0;
  else if(i%400==0)return 1;
  else if(i%100==0)return 0;
  return 1;
}

int main(){
  int a,b,k=11111;
  while(1){
    cin>>a>>b;
    if(a==0)break;
    if(k!=11111)cout<<endl;
    k=0;
    for(int i=a+1;i<b;i++){
      if(uruu(i)){k++;cout<<i<<endl;}
      
    }
    if(k==0)cout<<"NA"<<endl;
  }
  return 0;
}

C++: #include <stdio.h>

void uruu(int a, int b);

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


void uruu(int a, int b)
{
    int count = 0;
    for (int year = a; year <= b; ++year) {
        if (year % 4 == 0) {
            if (year % 100 != 0) {
                printf("%d\n", year);
                ++count;
            } else {
                if (year % 400 == 0) {
                    printf("%d\n", year);
                    ++count;
                }
            }
        }   
    }
    if (count == 0) {
        printf("NA\n");
    }
}