#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <queue>
using namespace std;

#define MAXV 1000000000
#define MOD 1000000007
using ll = long long;

bool operator<(const pair<int, int>& a, const pair<int, int>& b) {
	if (a.first == b.first) {
		return a.second < b.second;
	}
	return a.first < b.first;
}

int main() {

	int  y, m, d;
	while (cin >> y >> m >> d) {
		if (y < 1868) {
			cout << "pre-meiji" << endl;
		}
		else if (y == 1868 && m < 9) {
			cout << "pre-meiji" << endl;
		}
		else if (y == 1868 && m == 9 && d < 8) {
			cout << "pre-meiji" << endl;
		}
		else {
			int t = y * 10000 + m * 100 + d;
			if (t <= 1912 * 10000 + 7 * 100 + 29) {
				cout << "meiji" << " " << y - 1868 + 1 << " " << m << " " << d << endl;
			}
			else if(t <= 1926*10000 + 12*100 + 24){
				cout << "taisho" << " " << y - 1912 + 1 << " " << m << " " << d << endl;
			}
			else if (t <= 1989 * 10000 + 1 * 100 + 7) {
				cout << "showa" << " " << y - 1926 + 1 << " " << m << " " << d << endl;
			}
			else {
				cout << "heisei" << " " << y - 1989 + 1 << " " << m << " " << d << endl;
			}
		}
	}
}
