#include <iostream>

using std::cout;
using std::endl;

typedef enum {PRE, MEIJI, TAISHO, SHOWA, HEISEI} Gengou_t;

Gengou_t getGengou(int year_west, int month, int day);

int main()
{
    int year_west, month, day;
    while (std::cin >> year_west >> month >> day) {
        Gengou_t gengou = getGengou(year_west, month, day);
        int year_ja;

        switch (gengou) {
            case PRE:
                cout << "pre-meiji" << endl;
                break;
            case MEIJI:
                cout << "meiji ";
                year_ja = year_west - 1868 + 1;
                break;
            case TAISHO:
                cout << "taisho ";
                year_ja = year_west - 1912 + 1;
                break;
            case SHOWA:
                cout << "showa ";
                year_ja = year_west - 1926 + 1;
                break;
            case HEISEI:
                cout << "heisei ";
                year_ja = year_west - 1989 + 1;
                break;
        }

        if (gengou != PRE) {
            cout << year_ja << " " << month << " " << day << endl;
        }
    }

    return 0;
}

Gengou_t getGengou(int year_west, int month, int day)
{
    long yyyymmdd = 10000 * year_west + 100 * month + day;

    if (yyyymmdd < 18680908) {
        return PRE;
    } else if (yyyymmdd < 19120730) {
        return MEIJI;
    } else if (yyyymmdd < 19261225) {
        return TAISHO;
    } else if (yyyymmdd < 19890108) {
        return SHOWA;
    } else {
        return HEISEI;
    }
}