#include <iostream>
#include <cstdio>
#define MEIJI 1868
#define TAISHO 1912
#define SHOWA 1926
#define HEISEI 1989
using namespace std;
int year, month, date;

bool judge(int Fyear, int Tyear, int Fmonth, int Tmonth, int Fdate, int Tdate) {
    
    if(year > Fyear && year < Tyear) return(true); //年の間か？
    
    if(year == Fyear) { //始まりの年か
        if(Fmonth > month) return(false);//始まりの年より前ならばダメ
        //その月の分調べる
        for(int d = Fdate; d <= 31; d++) {
            if(month == Fmonth && date == d) return(true);
        }
        //それ以降を調べる
        for(int m = Fmonth+1; m <= 12; m++) {
            for(int d = 0; d <= 31; d++) {
                if(month == m && date == d) return(true);
            }
        }
    } else if(year == Tyear) { //終わりの年か
        if(Tmonth < month) return(false); //終わりの年より後ならばダメ
        //その月の分調べる
        for(int d = Tdate; d > 0; d--) {
            if(month == Tmonth && date == d) return(true);
        }
        //それ以前を調べる
        for(int m = Fmonth-1; m > 0; m--) {
            for(int d = 0; d <= 31; d++) {
                if(month == m && date == d) return(true);
            }
        }
    }
    return(false);
}

void output(int mode, int gengo) {
    string ans;
    switch(mode) {
        case 1: ans="meiji"; break;
        case 2: ans="taisho"; break;
        case 3: ans="showa";  break;
        default: ans="heisei"; break;
    }
    cout << ans << " " << (gengo+1) << " " << month << " " << date << endl;
}

void solve(int mode) {
    int start;
    switch(mode) {
        case 1: start = MEIJI; break;
        case 2: start = TAISHO; break;
        case 3: start = SHOWA;  break;
        default: start = HEISEI; break;
    }
    int gengo;
    for(int r = start; ; r++) {
        if(r == year){ gengo = r - start; break;}
    }
    output(mode, gengo);
}


int main(void) {
    while(cin >> year >> month >> date) {
        if(judge(1868, 1912, 9, 7, 8, 29)) solve(1);       //明治
        else if(judge(1912, 1926, 7, 12, 30, 24)) solve(2);//大正
        else if(judge(1926, 1989, 12, 1, 25, 7)) solve(3); //昭和
        else if(year > 1989 || (year == 1989 && month >= 1 && date >= 8)) solve(4);  //平成
        else cout << "pre-meiji" << endl;
        
    }
    
    return(0);
}