#include <bits/stdc++.h>
using namespace std;
/* {{{ */
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()
#define PB push_back
#define pb push_back
#define mp make_pair
#define FI first
#define SE second

inline int in(){int x;std::cin>>x;return x;}

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/
/* }}} */

int main(void)
{
  while (1){
    int a, b;
    bool frag = false;

    cin >> a >> b;
    if (a == 0 && b == 0) break;

    for (int i = a; i <= b; i++){
      if (i % 4 == 0 && i % 100 != 0){
        cout << i << endl;
        frag = true;
      }
      if (i % 100 == 0 && i % 400 == 0){
        cout << i << endl;
        frag = true;
      }
    }
    if (!frag) cout << "NA" << endl;
    cout << endl;
  }

  return 0;
}