#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int a = 0;
int b = 0;
int c = 0;


void input(void) {
	
	return ;
}


int main(void) {
	while (CI a >> b >> c) {
		if ((a >= 1989 && b >= 1 && c >= 8) || (a >= 1989 && b >= 2) || (a >= 1990)) {
			a -= 1988;
			CO "heisei "  << a << " " << b << " " << c E
		}
		else {
			if ((a >= 1926 && b >= 12 && c >= 25) || (a >= 1927)) {
				a -= 1925;
				CO "showa " << a << " " << b << " " << c E
			}
			else {
				if ((a >= 1912 && b >= 7 && c >= 30) || (a >= 1912 && b >= 8) || (a >= 1913)) {
					a -= 1911;
					CO "taisho " << a << " " << b << " " << c E
				}
				else {
					if ((a >= 1868 && b >= 9 && c >= 8) || (a >= 1868 && b >= 10) || (a >= 1869)) {
						a -= 1867;
						CO "meiji " << a << " " << b << " " << c E
					}
					else {
						CO "pre-meiji" E
					}
				}
			}
		}
	
	}
	


	return 0;
}