#include<iostream>
using namespace std;

int main()
{
    int m_lb = (1868*10000)+9*100+8,
        t_lb = (1912*10000)+7*100+30,
        s_lb = (1926*10000)+12*100+25,
        h_lb = (1989*10000)+1*100+8;
    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;
}