#include<iostream>
using namespace std;
int main(){
  int age,m,d;
  while(cin>>age>>m>>d){
    if(age>1989||age==1989&&m>1||age==1989&&m==1&&d>7){
      cout << "heisei " << age - 1989 + 1 << ' ' << m << ' ' << d << endl;
    } else if(age>1926||age==1926&&m>12||age==1986&&m==12&&d>24){
      cout << "showa " << age - 1926 + 1 << ' ' << m << ' ' << d << endl;
    } else if(age>1912||age==1912&&m>7||age==1912&&m==7&&d>29){
      cout << "taisyo " << age - 1912 + 1 << ' ' << m << ' ' << d << endl;
    } else if(age>1868||age==1868&&m>9||age==1868&&m==9&&d>7){
      cout << "taisyo " << age - 1868 + 1 << ' ' << m << ' ' << d << endl;
    } else cout << "pre-meiji" << endl;
  }
  return 0;
}