#include <iostream>
#include <vector>
using namespace std;

int main() {
  int n;
  const char *label[5] = {"pre-meiji", "meiji", "taisho", "showa", "heisei"};
  int date[4][3] = {{1868, 9, 8}, {1912, 7, 30}, {1926, 12, 25}, {1989, 1, 8}};
  vector<int> vdate[4], d(3);
  for (int i=0; i<4; i++) {
    vdate[i].assign(date[i], date[i]+3);
  }
  while (cin >> d[0] >> d[1] >> d[2]) {
    for (n=0; n<4; n++) {
      if (d < vdate[n]) break;
    }
    cout << label[n];
    if (n) {
      cout << ' ' << d[0]-date[n-1][0]+1 << ' ' << d[1] << ' ' << d[2];
    }
    cout << endl;
  }
  return 0;
}