#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int y,m,d;
	while(cin>>y>>m>>d){
		if(y>1989 || (y==1989 && (m>1 || (m==1 && d>=8)))){
			o("heisei "<<y-1988<<" "<<m<<" "<<d);
		}else if(y>1926 || (y==1926 && m==12 && d>=25)){
			o("showa "<<y-1925<<" "<<m<<" "<<d);
		}else if(y>1912 || (y==1912 && (m>7 ||(m==7 && d>=30)))){
			o("taisho "<<y-1911<<" "<<m<<" "<<d);
		}else if(y>1868 || (y==1868 && (m>9 || (m==9 && d>=8)))){
			o("meiji "<<y-1867<<" "<<m<<" "<<d);
		}else{
			o("pre-meiji");
		}
	}
}