#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
	int y,m,d;
	while(cin>>y>>m>>d){
		int val = d+100*m+10000*y;
		if(val>=8+100*1+10000*1989)			cout<<"heisei"<<" "<<(y-1989+1)<<" "<<m<<" "<<d<<endl;
		else if(val>=25+100*12+10000*1926)	cout<<"showa" <<" "<<(y-1926+1)<<" "<<m<<" "<<d<<endl;
		else if(val>=30+100*7 +10000*1912)	cout<<"taisho"<<" "<<(y-1912+1)<<" "<<m<<" "<<d<<endl;
		else if(val>=8 +100*9 +10000*1868)	cout<<"meiji" <<" "<<(y-1868+1)<<" "<<m<<" "<<d<<endl;
		else cout<<"pre-meiji"<<endl;
	}
}


/*

??????	??????
meiji	1868. 9. 8	???	1912. 7.29
taisho	1912. 7.30	???	1926.12.24
showa	1926.12.25	???	1989. 1. 7
heisei	1989. 1. 8	???
*/