#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, 15 },
	{ 1989, 1, 8 },
};

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

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