#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
ll zeller(ll y, ll m, ll d){
    if (m <= 2){
        y--;
        m += 12;
    }
    return (365 * y) + (y / 4) - (y / 100) + (y / 400) + (306 * (m + 1)) / 10 + d - 429;
}

int main(int argc, char ** argv) {
    int y, m, d;
    ll z1 = zeller(1868, 9, 8);
    ll z2 = zeller(1912, 7, 30);
    ll z3 = zeller(1926, 12, 25);
    ll z4 = zeller(1989, 1, 8);
    while (~scanf("%d%d%d", &y, &m, &d)){
        ll z = zeller(y, m, d);
        int idx = -1;
        char gen[][10] = {
            "heisei",
            "showa",
            "taisho",
            "meiji"
        };
        int zg = -1;
        if (z >= z4) idx = 0, zg = y - 1989 + 1;
        else if (z >= z3) idx = 1, zg = y - 1926 + 1;
        else if (z >= z2) idx = 2, zg = y - 1912 + 1;
        else if (z >= z1) idx = 3, zg = y - 1868 + 1;
        if (zg != -1) printf("%s %d %d %d\n", gen[idx], zg, m, d);
        else printf("pre-meiji\n");
    }
}