#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


vint d;
int data[5][3] = {
    {1868, 9, 8},
    {1912, 7, 30},
    {1926, 12, 25},
    {1989, 1, 8}, 
    {10000, 1, 1}
};


int main() {
    d.resize(3);
    
    vector<vector<int> > sec(4);
    for (int i = 0; i < 4; ++i) for (int j = 0; j < 3; ++j) sec[i].PB(data[i][j]);
    
    while (cin >> d[0] >> d[1] >> d[2]) {
        int it = upper_bound( ALL(sec), d ) - sec.begin();
        
        //cout << it << " : " << d;
        
        if (it == 0) puts("pre-meiji");
        else { 
            if (it == 1) d[0] -= 1867, cout << "meiji ";
            else if (it == 2) d[0] -= 1911, cout << "taisho ";
            else if (it == 3) d[0] -= 1925, cout << "showa ";
            else if (it == 4) d[0] -= 1988, cout << "heisei ";
            
            cout << d[0] << " " << d[1] << " " << d[2] << endl;
        }
    }
    
    return 0;
}
