#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl;
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

int main() {
	int y, m, d;
	VS gengo = { "pre-meiji","meiji","taisho","showa","heisei" };
	VI gday = { 0,1867,1911,1925,1988 };

	while (cin >> y >> m >> d) {
		int ty, day = y * 10000 + m * 100 + d;

		if (day < 18680908)ty = 0;
		else if (day <= 19120729)ty = 1;
		else if (day <= 19261224)ty = 2;
		else if (day <= 19890107)ty = 3;
		else ty = 4;

		if (ty == 0)Cout(gengo[0])
		else {
			cout << gengo[ty] << " " << y - gday[ty] << " " << m << " " << d << endl;
		}
	}

}
