#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int> PI;
#define MAX 99999999
char s[]={" "};
int main(){
    int y,m,d;
    while(cin>>y>>m>>d){
        if(y<1868||(y==1868&&m<9)||(y==1868&&m==9&&d<8))cout<<"pre-meiji"<<endl;
        else if((1868<=y&&y<1912)||(y==1912&&m<7)||(y==1912&&m==7&&d<=29))cout<<"meiji"<<" "<<(y-1868+1)<<s<<m<<s<<d<<endl;
        else if((1912<=y&&y<1926)||(y==1926&&m<12)||(y==1926&m==12&&d<=24))cout<<"taisho"<<s<<(y-1912+1)<<s<<m<<s<<d<<endl;
        else if((1926<=y&&y<1989)||(y==1989&&m<1)||(y==1989&&m==1&&d<=7))cout<<"showa"<<s<<(y-1926+1)<<s<<m<<s<<d<<endl;
        else
            cout<<"heisei"<<s<<(y-1989+1)<<s<<m<<s<<d<<endl;

    }
}