#include<iostream>
#include<string>

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
using namespace std;

const int Yb = 0;
const int Mb = 1;
const int Db = 2;
const int Ye = 3;
const int Me = 4;
const int De = 5;

const int table[4][6] =
  {{1868, 9, 8 ,1912, 7,29},
   {1912, 7,30 ,1926,12,24},
   {1926,12,25 ,1989, 1, 7},
   {1989, 1, 8 ,3000,12,31}};

const string name[4] = {
  "meiji",
  "taisho",
  "showa",
  "heisei"
};

int main(void){
  int y,m,d;
  while(cin>>y>>m>>d){
    if(y<table[0][Yb] || 
       (y==table[0][Yb] && m<table[0][Mb]) || 
       (y==table[0][Yb] && m==table[0][Mb] && d<table[0][Db])){
      cout<<"pre-meiji"<<endl;
      continue;
    }
    bool find = false;
    loop(i,1,3){
      if(y<table[i][Ye] || 
	 (y==table[i][Ye] && m<table[i][Me]) || 
	 (y==table[i][Ye] && m==table[i][Me] && d<table[i][De])){
	cout<<name[i]<<" "<<y-table[i-1][Ye]+1<<" "<<m<<" "<<d<<endl;
	find = true;
	break;
      }
    }	 
    if(find)continue;
    cout<<name[3]<<" "<<y-table[3][Ye]+1<<" "<<m<<" "<<d<<endl;
      
    
  }

}