#include <iostream>
#include <cstdio>

using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	const int begin[5][3] = {1868, 9, 8, 1912, 7, 30, 1926, 12, 25, 1989, 1, 8, 9999, 12, 31};
	int y,m,d;
	while(cin >> y >> m >> d) {
		int i=0;
		while(begin[i][0] < y) i++;
		if(begin[i][0] == y && (begin[i][1] < m || begin[i][1] == m && begin[i][2] <= d)) i++;
		if(i!=0) y -= begin[i-1][0] - 1;
		switch(i) {
		case 0: cout << "pre-meiji" << endl; break;
		case 1: cout << "meiji"; break;
		case 2: cout << "taisho"; break;
		case 3: cout << "showa"; break;
		case 4: cout << "heisei"; break;
		}
		if(i!=0) cout << " " << y << " " << m << " " << d << endl;
	}
	return 0;
}