#include <iostream>
using namespace std;

struct Date
{
    Date(int y, int m, int d) : year(y), month(m), day(d) {}
    int year, month, day;
    
    bool operator< (const Date& rhs) const
    {
         return year == rhs.year ? month == rhs.month ? day < rhs.day : month < rhs.month : year < rhs.year;
    }
    
    bool operator<= (const Date& rhs) const
    {
        return *this < rhs || year == rhs.year && month == rhs.month && day == rhs.day; 
    }
};

int main()
{
    int year, month, day;
    const Date meiji(1868,9,8), taisho(1912,7,30), showa(1926,12,25), heisei(1989,1,8);
    while(cin >> year >> month >> day){
        Date date(year, month, day);
        if(date < meiji){
            cout << "pre-meiji" << endl;
        } else if(meiji <= date && date < taisho){
            cout << "meiji" << ' ' << year - meiji.year + 1 << ' ' << month << ' ' << day << endl;  
        } else if(taisho <= date && date < showa){
            cout << "taisho" << ' ' << year - taisho.year + 1 << ' ' << month << ' ' << day << endl; 
        } else if(showa <= date && date < heisei){
            cout << "showa" << ' ' << year - showa.year + 1 << ' ' << month << ' ' << day << endl; 
        } else {
            cout << "heisei" << ' ' << year - heisei.year + 1 << ' ' << month << ' ' << day << endl; 
        }
    }
}