#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

struct P {
  int y, m, d;
  P(int y = 0, int m = 0, int d = 0) : y(y), m(m), d(d) {}
};

bool operator < (const P& a, const P& b) {
  return a.y != b.y ? a.y < b.y : a.m != b.m ? a.m < b.m : a.d < b.d;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  P a;
  while (cin >> a.y >> a.m >> a.d) {
    if (a < P(1868, 9, 8)) cout << "pre-meiji" << endl;
    else if (a < P(1912, 7, 30)) cout << "meiji " << a.y - 1868 + 1 << " " << a.m << " " << a.d << endl;
    else if (a < P(1926, 12, 25)) cout << "taisho " << a.y - 1912 + 1 << " " << a.m << " " << a.d << endl;
    else if (a < P(1989, 1, 8)) cout << "showa " << a.y - 1926 + 1 << " " << a.m << " " << a.d << endl;
    else cout << "heisei " << a.y - 1989 + 1 << " " << a.m << " " << a.d << endl;
  }

  return 0;
}
