#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int era[][3] = {
	{ 0, 0, 0 },
	{ 1868, 9, 8 },
	{ 1912, 7, 30 },
	{ 1926, 12, 25 },
	{ 1989, 1, 8 },
};

string s[] = {"pre-meiji", "meiji", "taisho", "showa", "heisei"};

int main() {
	int y, m, d;
	while (cin >> y >> m >> d) {
		string name = "";
		int ny;
		for (int i = 4; i >= 0; i--) {
			int yy = era[i][0];
			int mm = era[i][1];
			int dd = era[i][2];
			ny = y - yy + 1;
			name = s[i];
			if (y < yy)
				continue;
			else if (y > yy)
				break;
			else {
				if (m > mm)
					break;
				else if (m == mm)
					if (d >= dd)
						break;
			}
		}
		if (name == s[0])
			cout << name << endl;
		else
			cout << name << " " << ny << " " << m << " " << d << endl;
	}
	return 0;
}