#include<iostream>
using namespace std;

int main()
{
  int a,b;
  bool cf=false;
  for(;cin>>a>>b,a||b;)
    {
      if(cf)
	cout<<endl;
      cf=true;
      bool c=true;
      for(;a<=b;a++)
	{
	  if(a%4==0 && (a%100!=0 || a%400==0))
	    {
	      cout<<a<<endl;
	      c=false;
	    }
	}
      if(c)
	cout<<"NA"<<endl;

    }
}