// #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

int main(){
	int year, month, day, ansYear;
	string gengou;
	while (cin >> year >> month >> day){
		ansYear = 0;
		if (year > 1989 || (year == 1989 && (month > 1 || month == 1 && day >= 8))){
			gengou = "heisei";
			ansYear = year - 1989;
		}
		else if (year > 1926 || (year == 1926 && (month >= 12 && day >= 25))){
			gengou = "showa";
			ansYear = year - 1926;
		}
		else if (year > 1912 || (year == 1912 && (month > 7 || month == 7 && day >= 30))){
			gengou = "taisho";
			ansYear = year - 1912;
		}
		else if (year > 1868 || (year == 1868 && (month > 9 || month == 9 && day >= 8))){
			gengou = "meiji";
			ansYear = year - 1868;
		}
		else
			gengou = "pre-meiji";

		ansYear++;
		if (gengou == "pre-meiji")
			cout << gengou << endl;
		else
			cout << gengou << " " << ansYear << " " << month << " " << day << endl;
	}
	return 0;
}