#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

#define MAX 1010

const char *gen[5] = {
  "pre-meiji",
  "meiji",
  "taisho",
  "showa",
  "heisei"
};

int data[4][3] = {
  {1868,9,8},
  {1912,7,30},
  {1926,12,25},
  {1989,1,8}
};

int main(){
  int y, m, d;
  while(cin>>y>>m>>d){
    int ans = 0;
    REP(i, 4)
      if((y >  data[i][0]) ||
	 (y == data[i][0] && m >  data[i][1]) ||
	 (y == data[i][0] && m == data[i][1] && d >= data[i][2]))
	ans++;
    printf("%s",gen[ans]);
    if(ans != 0)
      printf(" %d %d %d", y-data[ans-1][0]+1, m, d);
    puts("");
  }
  return 0;
}