#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

class date {
public:
	int year, month, day;
	bool operator<(const date&d);
	string gengoh();
	int year_wareki();
};
const date meiji_ganzitsu{ 1868,9,8 }, taisho_ganzitsu{ 1912,7,30 }, showa_ganzitsu{ 1926,12,25 }, heisei_ganzitsu{ 1989,1,8 };
bool date::operator<(const date&d)
{
	return year < d.year || year == d.year && (month < d.month || month == d.month && day < d.day);
}
string date::gengoh() {
	return
		*this < meiji_ganzitsu ? "pre-meiji" :
		*this < taisho_ganzitsu ? "meiji" :
		*this < showa_ganzitsu ? "taisho" :
		*this < heisei_ganzitsu ? "showa" : "heisei";
}
int date::year_wareki()
{
	return year - (
		gengoh() == "meiji" ? meiji_ganzitsu.year :
		gengoh() == "taisho" ? taisho_ganzitsu.year :
		gengoh() == "showa" ? showa_ganzitsu.year : heisei_ganzitsu.year
		) + 1;
}

signed main()
{
	int year, month, day;
	while (cin >> year >> month >> day) {
		date d{ year, month, day };
		cout << d.gengoh();
		if (d.gengoh() != "pre-meiji")cout << ' ' << d.year_wareki() << ' ' << d.month << ' ' << d.day;
		cout << endl;
	}
}
