#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> Point;

struct Date
{
	int year, month, day;
	Date(int y, int m, int d) : year(y), month(m), day(d) {}
	Date() {}

	bool operator<(const Date& d)const
	{
		if(year != d.year)
			return year < d.year;
		if(month != d.month)
			return month < d.month;
		return day < d.day;
	}
};

int main()
{
	const Date begin[] = { Date(1868, 9, 8), Date(1912, 7, 30), Date(1926, 12, 25), Date(1989, 1, 8) };
	const char* name[] = { "pre_meiji", "meiji", "taisho", "showa", "heisei" };

	Date d;
	while(scanf("%d%d%d", &d.year, &d.month, &d.day) != EOF){
		int id = distance(begin, lower_bound(begin, begin+4, d));
		if(id)
			printf("%s %d %d %d\n", name[id], d.year-begin[id-1].year+1, d.month, d.day);
		else
			puts(name[id]);
	}

	return 0;
}