#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-11
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  int y,m,d;
  while(~scanf("%d%d%d",&y,&m,&d)){
    if(y<1868 || (y==1868 && (m<9 || (m==9 && d<8)))){
      cout<<"pre-meiji"<<endl;
    }else if(y<1912 || (y==1912 && (m<7 || (m==7 && d<30)))){
      printf("meiji %d %d %d\n",y-1867,m,d);
    }else if(y<1926 || (y==1926 && (m<12 || (m==12 && d<25)))){
      printf("taisho %d %d %d\n",y-1911,m,d);
    }else if(y<1989 || (y==1989 && m==1 && d<8)){
      printf("showa %d %d %d\n",y-1925,m,d);
    }else{
      printf("heisei %d %d %d\n",y-1988,m,d);
    }
  }
  return 0;
}