#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <sstream>
#include <vector>
#include <string>
#include <iomanip>
#include <bitset>
using namespace std;
#define INF	100000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define sz(x) ((int)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).begin(), (x).end(), greater<int>() )
#define clr(a,b) memset((a),(b),sizeof(a))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

int y,m,d;
ll t;
ll x[4] = {19890108,19261225,19120730,18680908};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(cin >> y >> m >> d){
		t = 10000*y+100*m+d;
		if(t >= x[0]) cout << "heisei " << y-(x[0]/10000)+1 << " " << m << " " << d << endl;
		else if(t >= x[1]) cout << "showa " << y-(x[1]/10000)+1 << " " << m << " " << d << endl;
		else if(t >= x[2]) cout << "taisho " << y-(x[2]/10000)+1 << " " << m << " " << d << endl;
		else if(t >= x[3]) cout << "meiji " << y-(x[3]/10000)+1 << " " << m << " " << d << endl;
		else cout << "pre-meiji" << endl;
	}
}