#include #include #include #include #include #include #include #include using namespace std; const int maxn=100000; int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; bool isleap(int x){ if(x%400==0)return true; if(x%100!=0&&x%4==0)return true; return false; } int f(int y,int m,int d){ if(isleap(y))a[2]=29; int ret=d; for(int i=1;i12||m<1)return true; if(d>a[m]||d<1)return true; a[2]=28; return false; } int main(){ int y,m,d; while(cin>>y>>m>>d){ if(isno(y,m,d)){ cout<<"illegal"<