#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main(){
	int a,b,c;
	while(scanf("%d %d %d",&a,&b,&c)!=EOF){
		int ryu=a*365+(b-1)*31+c;
		if(ryu>=725993){
			printf("heisei %d %d %d",a-1988,b,c);
		}else if(ryu>=703356){
			printf("showa %d %d %d",a-1925,b,c);
		}else if(ryu>=698096){
			printf("taisho %d %d %d",a-1911,b,c);
		}else if(ryu>=682076){
			printf("meiji %d %d %d",a-1867,b,c);
		}else{
			printf("pre-meiji");
		}
		puts("");
	}
}