#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

bool isPreMeiji(int year, int month, int day) {
    if (year < 1868) return true;
    if (year == 1868) {
        if (month < 9) return true;
        if (month > 9) return false;
        return day < 8;
    }
    return false;
}

bool isMeiji(int year, int month, int day) {
    if (year < 1912) return true;
    if (year == 1912) {
        if (month < 7) return true;
        if (month > 7) return false;
        return day < 30;
    }
    return false;
}

bool isTaisho(int year, int month, int day) {
    if (year < 1926) return true;
    if (year == 1926) {
        if (month < 12) return true;
        if (month > 12) return false;
        return day < 25;
    }
    return false;
}

bool isShowa(int year, int month, int day) {
    if (year < 1989) return true;
    if (year == 1989) {
        if (month < 1) return true;
        if (month > 1) return false;
        return day < 8;
    }
    return false;
}

int getMeijiYear(int year) {
    return year - 1868 + 1;
}

int getTaishoYear(int year) {
    return year - 1912 + 1;
}

int getShowaYear(int year) {
    return year - 1926 + 1;
}

int getHeiseiYear(int year) {
    return year - 1989 + 1;
}

int main() {
    int year;
    int month;
    int day;
    while(cin>>year>>month>>day) {
        if (isPreMeiji(year,month,day)) {
            cout << "pre-meiji" << endl;
        }else if (isMeiji(year,month,day)) {
            cout << "meiji " << getMeijiYear(year) << " ";
            cout << month << " " << day << endl;
        }else if (isTaisho(year,month,day)) {
            cout << "taisho " << getTaishoYear(year) << " ";
            cout << month << " " << day << endl;
        }else if (isShowa(year,month,day)) {
            cout << "showa " << getShowaYear(year) << " ";
            cout << month << " " << day << endl;
        }else {
            cout << "heisei " << getHeiseiYear(year) << " ";
            cout << month << " " << day << endl;
        }
    }
    return 0;
}