#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;
 
#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
 
static const double PI=6*asin(0.5);
typedef pair<int,int> P;
typedef complex<double> CP;
typedef long long ll;

int year,month,day;
ll sum;
char s[6][100]={"pre-meiji","meiji","taisho","showa","heisei"};
/*
s[0]="pre-meiji";
s[1]="meiji";
s[2]="taisho";
s[3]="showa";
s[4]="heisei";
*/


int main(){
	while(cin>>year>>month>>day){
		int a;
		sum=year*10000+month*100+day;
		if(sum<18680908) a=0;
		else if(sum<=19120729){
			a=1;
			year-=1867;
		}
		else if(sum<=19261224){
			a=2;
			year-=1911;
		}
		else if(sum<=19890107){
			a=3;
			year-=1925;
		}
		else{
			a=4;
			year-=1988;
		}
		cout<<s[a];
		if(a!=0) cout<<" "<<year<<" "<<month<<" "<<day<<endl;
		else cout<<endl;
	}
	return 0;
}