#include <iostream>
using namespace std;

int main()
{
  int y, m, d;
  long n[4], num;

  n[0] = 1868 * 10000 + 9 * 100 + 8;
  n[1] = 1912 * 10000 + 7 * 100 + 30;
  n[2] = 1926 * 10000 + 12 * 100 + 25;
  n[3] = 1989 * 10000 + 1 * 100 + 8;

  while (cin >> y >> m >> d){
    num = y * 10000 + m * 100 + d;
  
    if (n[0] <= num && num < n[1]){
      cout << "meiji " << y - 1867 << ' ' << m << ' ' << d;
    }
    else if (n[1] <= num && num < n[2]){
      cout << "taisho " << y - 1911 << ' ' << m << ' ' << d;
    }
    else if (n[2] <= num && num < n[3]){
      cout << "showa " << y - 1925 << ' ' << m << ' ' << d;
    }
    else if (n[3] <= num){
      cout << "heisei " << y - 1988 << ' ' << m << ' ' << d;
    }
    else {
      cout << "pre-meiji";
    }
    cout << endl;
  }
  return (0);
}