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 <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 == 0) {
      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<bits/stdc++.h>
using namespace std;

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

C++: #include <stdio.h>

int main(){

	int a,b;
	int i;
	int answer;
	int count;

	while(1){
		count = 0;

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

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

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

	return 0;
}

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

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

C++: #include<iostream>
#include<vector>
using namespace std;
int main() {
	int a, b;
	vector<int>aa;
	vector<int>bb;
	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++){
		bool b = false;
		for (int j = aa[i]; j <= bb[i]; j++){
		if (j % 4 == 0) 
			if (j % 100 == 0) {
				if (j % 400 == 0) {
					b = true;
					cout << j << endl;
				}
			}
			else {
				b = true;
				cout << j << endl; 
			}
		}
		if (b == false)cout << "NA\n";
		cout << endl;
	}
	char c;
	cin >> c;
}

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

C++: #include <iostream>
using namespace std;
bool chk(int n){
  return (n % 4 == 0) - (n%100 == 0) + (n%400 ==0);
}

int main(void){
  int a,b,res = 0;
  bool first = false;
  while(cin>>a>>b,a+b){
    bool used = false;
    if(first)cout<<endl;
    first = true;

    for(int i = a ; i <= b ; i ++)
      if(chk(i)){
	cout<<i<<endl;
	used = true;
      }
    if(!used)cout<<"NA"<<endl;
  }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#define INF 999999
using namespace std;
int main(){
    int A,B;
    while(cin>>A>>B,A){
        int FLG=0;
        for(int i=A;i<=B;i++){
            int FLGS=0;
            if(i%4==0)FLGS=1;
            if(i%100==0)FLGS=0;
            if(i%400==0)FLGS=1;
            if(FLGS==1){cout<<i<<endl;FLG=1;}
        }
        if(FLG==0)cout<<"NA"<<endl;
    }
    return 0;
}

C++: /*
    2014.07.04 1230~1238
    C language Lecture week ∞
*/

#include <stdio.h>

int leap_chk ( int year );

int main (void) {
    
    int init;
    int last;
    
    int count = 0;
    
    while (1) {
        
        scanf ( "%d", &init );
        scanf ( "%d", &last );
        
        if ( init == 0 && last == 0 ) {
            break;
        }
        
        for ( int ly = init; ly <= last; ly ++ ) {
            if ( leap_chk ( ly ) ) {
                printf ( "%d\n", ly );
                count ++;
            }
        }
        
        if ( count == 0 ) {
            printf ( "NA\n" );
        }
        printf ( "\n" );
        
    }
    
    return 0;
    
}

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

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

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int from,to;
	bool first=true;
	while(cin>>from>>to&&!(from==0&&to==0)){
		bool f=false;
		if(first){
			first=false;
		}
		else
			cout<<endl;

		for(int i = from; i <= to; i++){
			if(i%4==0&&i%100!=0){
				f=true;
				cout<<i<<endl;
			}
			else if(i%400==0){
				f=true;
				cout<<i<<endl;
			}
		}
		if(!f){
			cout<<"NA"<<endl;
		}
	}


	return 0;
}

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\n");
		}
		printf("\n");
		x = true;
	}
	
	return (0);
}

C++: #include <stdio.h>

int main(){

	int a,b;
	int i;
	int answer;
	int count;
	int check = 0;

	while(1){
		count = 0;

		scanf("%d %d",&a,&b);
		
		if(check == 1){
			printf("\n");
		}

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

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

	return 0;
}