g#include <iostream>
#include <string>

using namespace std;

struct Date {
    int year, month, day;
    Date(int year=0, int month=1, int day=1) : year(year), month(month), day(day) {}
    bool operator<(const Date &o) const {
        if (year == o.year) {
            if (month == o.month) {
                return day < o.day;
            }
            return month < o.month;
        }
        return year < o.year;
    }
};

int main() {
    int year, month, day;
    Date meiji_start(1868, 9, 8), meiji_end(1912, 7, 29),
         taisho_start(1912, 7, 30), taisho_end(1926, 12, 24),
         showa_start(1926, 12, 25), showa_end(1989, 1, 7),
         heisei_start(1989, 1, 8);

    while (cin >> year >> month >> day) {
        Date date(year, month, day);
        if (date < meiji_start) {
            cout << "pre-meiji" << endl;
        } else if (date < taisho_start) {
            cout << "meiji " << date.year - meiji_start.year   + 1 << ' ' << date.month << ' ' << date.day << endl;
        } else if (date < showa_start) {
            cout << "taisho " << date.year - taisho_start.year + 1 << ' ' << date.month << ' ' << date.day << endl;
        } else if (date < heisei_start) {
            cout << "showa " << date.year - showa_start.year   + 1 << ' ' << date.month << ' ' << date.day << endl;
        } else {
            cout << "heisei " << date.year - heisei_start.year + 1 << ' ' << date.month << ' ' << date.day << endl;
        }
    }

    return 0;
}