#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

#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()

int main() {
  int y,m,d;
  while(cin>>y>>m>>d) {
    int a;
    if (y<1868||y==1868&&m<9||y==1868&&m==9&&d<8) {
      cout << "pre-meiji";
      a = -1;
    } else if (y<1912||y==1912&&m<7||y==1912&&m==7&&d<=29) {
      cout << "meiji";
      a = y-1868;
    } else if (y<1926||y==1926&&m<12||y==1926&&m==12&&d<=24) {
      cout << "taisho";
      a = y-1912;
    } else if (y<1989||y==1989&&m<1||y==1989&&m==1&&d<=7) {
      cout << "showa";
      a = y-1926;
    } else {
      cout << "heisei";
      a = y-1989;
    }
    if (a>=0) {
      printf(" %d %d %d",a+1, m, d);
    }
    cout << endl;
  }
}