#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>

using namespace std;

int main()
{
    int y, m, d;
    int meiji[3] = {1868, 9, 8};
    int taisho[3] = {1912, 7, 30};
    int showa[3] = {1926, 12, 25};
    int heisei[3] = {1989, 1, 8};
    while(cin >> y >> m >> d)
    {
        if(y < meiji[0] || (y == meiji[0] && m < meiji[1]) || 
          (y == meiji[0] && m == meiji[1] && d < meiji[2]))
            cout << "pre-meiji" << endl;
        else if(y < taisho[0] || (y == taisho[0] && m < taisho[1]) || 
               (y == taisho[0] && m == taisho[1] && d < taisho[2]))
            cout << "meiji " << y-meiji[0]+1 << " " << m << " " << d << endl;
        else if(y < showa[0] || (y == showa[0] && m < showa[1]) || 
               (y == showa[0] && m == showa[1] && d < showa[2]))
            cout << "taisho " << y-taisho[0]+1 << " " << m << " " << d << endl;
        else if(y < heisei[0] || (y == heisei[0] && m < heisei[1]) || 
               (y == heisei[0] && m == heisei[1] && d < heisei[2]))
            cout << "showa " << y-showa[0]+1 << " " << m << " " << d << endl;
        else
            cout << "heisei " << y-heisei[0]+1 << " " << m << " " << d << endl;
    }
}