#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  while (cin >> a >> b) {
    if (a == b && a == 0) {
      break;
    }
    for (c = 0; a < b; a++) {
      if ((a % 4 == 0) && ((a % 400 != 0) || (a % 400 == 0))) {
        cout << a << endl;
        c++;
      }
    }
    if (!c) {
      cout << "NA" << endl;
    }
    cout << endl;
  }
  return 0;
}