#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

struct Date {
  int y, m, d;
  bool operator < (const Date &date) const {
    if(y != date.y) return y < date.y;
    if(m != date.m) return m < date.m;
    return d < date.d;
  }
};

const int N = 5;
string name[N] = {"pre-meiji", "meiji", "taisho", "showa", "heisei"};
Date begin[N] = {{0,0,0}, {1868,9,8}, {1912,7,30}, {1926,12,25}, {1989,1,8}};

int main() {
  int y, m, d;
  while(cin >> y >> m >> d) {
    Date now = {y,m,d};
    for(int i = 0; i < N; ++i) {
      if(i+1 == N || now < begin[i+1]) {
        if(i == 0) cout << name[i] << endl;
        else {
          cout << name[i] << " " << now.y - begin[i].y + 1
               << " " << now.m << " " << now.d << endl;
        }
        break;
      }
    }
  }
  return 0;
}