#include <iostream>
#include <cstdio>
using namespace std;

int main(void)
{
	int y, m, d;
	int a;
	while (scanf("%d%d%d", &y, &m, &d) != EOF){
		a = (y * 10000 +m * 100 + d);
		if (a < 18680908) {
			cout << "pre-meiji" << endl;
			continue;
		}
		if (a < 19120730){
			cout << "meiji " << y-1867 << " " << m << " " << d << endl;
			continue;
		}
		if (a < 19261225){
			cout << "taisho " << y-1911 << " " << m << " " << d << endl;
			continue;
		}
		if (a < 19890108){
			cout << "showa " << y-1925 << " " << m << " " << d << endl;
			continue;
		}
		cout << "heisei " << y-1988 << " " << m << " " << d << endl;
	}
	
	return 0;
}