#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int y0[] = {1868, 1912, 1926, 1989};
    int m0[] = {9, 7, 12, 1};
    int d0[] = {8, 30, 25, 8};
    char s0[][10] = {"pre-meiji", "meiji", "taisho", "showa", "heisei"};

    for(;;){
        int y, m, d;
        if(!(cin >> y >> m >> d))
            return 0;

        for(int i=0; i<5; ++i){
            if(i == 4 || y < y0[i] || y == y0[i] && m < m0[i] || y == y0[i] && m == m0[i] && d < d0[i]){
                cout << s0[i];
                if(i != 0)
                    cout << ' ' << (y-y0[i-1]+1) << ' ' << m << ' ' << d;
                cout << endl;
                break;
            }
        }
    }
}