#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;


string s[5] = { "pre-meiji", "meiji", "taisho", "showa", "heisei" };
int t[4] = { 18680908, 19120730, 19261225, 19890108 };


int main(){
	int a, b, c;
	while (cin >> a >> b >> c){
		int d = a * 10000 + b * 100 + c;
		for (int i = 0; i < 4; i++){
			if (d < t[i]){
				if (i == 0)cout << s[i] << endl;
				else{
					cout << s[i] << " " << a - t[i - 1] / 10000 +  1 << " " << b << " " << c << endl;
				}
				break;
			}
		}
		if (d >= t[3])cout << s[4] << " " << a - t[3] / 10000 + 1 << " " << b << " " << c << endl;
	}
}