#include <iostream>

using namespace std;

int main()
{
    int year, month, day;

    while (cin >> year >> month >> day) {
        if (year >= 1990 || (year == 1989 && month >= 2) ||
            (year == 1989 && month == 1 && day >= 8))
            cout << "heisei " << year - 1989 + 1;
        else if (year >= 1927 || (year == 1926 && month == 12 && day >= 25))
            cout << "showa " << year - 1926 + 1;
        else if (year >= 1913 || (year == 1912 && month >= 8) ||
                 (year == 1912 && month == 7 && day >= 30))
            cout << "taisho " << year - 1912 + 1;
        else if (year >= 1869 || (year == 1868 && month >= 10) ||
                 (year == 1868 && month >= 9 && day >= 8))
            cout << "meiji " << year - 1868 + 1;
        else {
            cout << "pre-meiji" << endl;
            continue;
        }

        cout << " " << month << "  " << day << endl;
    }

    return 0;
}