#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>

using namespace std;

int main()
{
	int Year[] = { 1868, 1912, 1926, 1989 };
	int Month[] = { 9, 7, 12, 1 };
	int Day[] = { 8, 30, 25, 8 };
	char* era[] = { "meiji", "taisho", "showa", "heisei" };
	const int wy = 10000;
	const int wm = 100;
	int y, m, d;
	while (scanf("%d %d %d", &y, &m, &d) != EOF)
	{
		int t = y*wy + m*wm + d;
		int i;
		for (i = 0; i < 4 && t >= Year[i]*wy + Month[i]*wm + Day[i]; ++i)
			;
		if (i == 0)
			printf("pre-meiji\n");
		else
		{
			--i;
			printf("%s %d %d %d\n", era[i], y-Year[i]+1, m, d);
		}
	}

	return 0;
}