#include <iostream>
#include <cstdio>
using namespace std;

int era(int year, int month, int day) {
    if (year < 1868
        || (year == 1868
            && (month < 9
                || (month == 9 && day < 8))
        )) {
        return 0;
    } else if (year < 1912
               || (year == 1912
                   && (month < 7
                       || (month == 7 && day < 30))
               )) {
        return 1;
    } else if (year < 1926
               || (year == 1926
                   && (month < 12
                       || (month == 12 && day < 25))
               )) {
        return 2;
    } else if (year < 1989
               || (year == 1989 && month == 1 && day < 8)) {
        return 3;
    } else {
        return 4;
    }
}

int main() {
    int year, month, day;
    while (cin >> year >> month >> day) {
        switch (era(year, month, day)) {
        case 0:
            cout << "pre-meiji" << endl;
            break;
        case 1:
            printf("%s %d %d %d\n", "meiji", year - 1867, month, day);
            break;
        case 2:
            printf("%s %d %d %d\n", "taisho", year - 1911, month, day);
            break;
        case 3:
            printf("%s %d %d %d\n", "showa", year - 1925, month, day);
            break;
        case 4:
            printf("%s %d %d %d\n", "heisei", year - 1988, month, day);
            break;
        }
    }
}