#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, int>

vector<string> split(string str){
  stringstream ss(str);
  string tmp;
  vector<string> ret;
  while(getline(ss, tmp, ' ')) ret.push_back(tmp);
  return ret;
}

string make_s(vector<string> &v){
  stringstream ss;
  REP(i, 4 - v[0].size()) ss << "0";
  ss << v[0];
  REP(i, 2 - v[1].size()) ss << "0";
  ss << v[1];
  REP(i, 2 - v[2].size()) ss << "0";
  ss << v[2];
  return ss.str();
}

int main() {
  string str;
  while(getline(cin, str)){
    vector<string> tmp = split(str);
    string s = make_s(tmp);
    int y = atoi(tmp[0].c_str()), m = atoi(tmp[1].c_str()), d = atoi(tmp[2].c_str()), s_i = atoi(s.c_str());

    if(s_i < 18680908){
      cout <<"pre-meiji" <<endl;
    } else if(s_i < 19120730){
      cout <<"meiji " <<y - 1868 + 1 <<" " <<m <<" " <<d <<endl;
    } else if(s_i < 19261225){
      cout <<"taisho " <<y - 1912 + 1 <<" " <<m <<" " <<d <<endl;
    } else if(s_i < 19890108){
      cout <<"showa " <<y - 1926 + 1 <<" " <<m <<" " <<d <<endl;
    } else{
      cout <<"heisei " <<y - 1989 + 1 <<" " <<m <<" " <<d <<endl;
    }
  }
  return 0;
}