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

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int a,b,c;
	while(cin>>a>>b>>c){
		if(cin.eof())break;
		int d =a*10000+b*100+c;
		if(d<18680908)cout<<"pre-meiji"<<endl;
		else if(d>=18680908&&d<=19120729){
			cout<<"meiji "<<a-1867<<' '<<b<<' '<<c<<endl;
		}
		else if(d>=19120730&&d<=19261224){
			cout<<"taisho "<<a-1911<<' '<<b<<' '<<c<<endl;
		}
		else if(d>=19261225&&d<=19890107){
			cout<<"showa "<<a-1925<<' '<<b<<' '<<c<<endl;
		}
		else{
			cout<<"heisei "<<a-1988<<' '<<b<<' '<<c<<endl;
		}
	}

	return 0;
}