#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

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