#include <iostream>

using namespace std;

int main() {
  int y, m, d;
  while (cin >> y >> m >> d) {
    if (1989 < y || (1989 == y && 108 <= m * 100 + d))
      cout << "heisei" << " " << y - 1988 << " " << m << " " << d << endl;
    else if (1926 < y || (y==1926 && 1225 <= m * 100 + d))
      cout << "showa" << " " << y - 1925 << " " << m << " " << d << endl;
    else if (1912 < y || (y==1912 && 730 <= m * 100 + d))
      cout << "taisho" << " " << y - 1911 << " " << m << " " << d << endl;
    else if (1868 < y || (y==1868 && 908 <= m * 100 + d))
      cout << "meiji" << " " << y - 1867 << " " << m << " " << d << endl;
    else
      cout << "pre-meiji" << endl;
  }
}
