    int y,m,d,now;
    while(cin>>y>>m>>d)
    {
        now = y*10000+m*100+d;
        if(now<m_lb){cout << "pre-meiji"<<endl;continue;}
        if(now<t_lb){cout << "meiji "<<y-1867 << " " <<m<<" "<< d<<endl; continue;}
        if(now<s_lb){cout << "taisho "<<y-1911 << " " <<m<<" "<< d<<endl; continue;}
        if(now<h_lb){cout << "showa "<<y-1925 << " " <<m<<" "<< d<<endl; continue;}
        cout << "heisei "<<y-1988 << " " <<m<<" "<< d<<endl; continue;

    }

    return 0;
}