#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	auto encode = [](int y,int m,int d){
		return y*12*31+m*31+d;
	};

	int Y,M,D;
	while(cin>>Y){
		cin>>M>>D;

		int E = encode(Y,M,D);

		int Meiji = encode(1868,9,8);
		int Taisho = encode(1912,7,30);
		int Showa = encode(1926,12,25);
		int Heisei = encode(1989,1,8);
		if(E<Meiji){
			out("pre-meiji");
		}
		else if(Meiji<=E && E<Taisho){
			out("meiji",Y-1868+1,M,D);
		}
		else if(Taisho<=E && E<Showa){
			out("taisho",Y-1912+1,M,D);
		}
		else if(Showa<=E && E<Heisei){
			out("showa",Y-1926+1,M,D);
		}
		else if(Heisei<=E){
			out("heisei",Y-1989+1,M,D);
		}
	}
	return 0;
}
