#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
string high[] = { "","tam","hel","maa","huh","tou","kes","hei","elo","syy","lok","mer","jou" };
string low[] = {"","jan","feb","mar","apr","may","jun","jly","aug","sep","oct","nov","dec" };
map<string, int>hxw;
for (int i = 0; i <=12 ; i++)
for (int j = 0; j <= 12; j++)
{
if(i==0)
hxw[low[j]] = j;
else if(j==0)
hxw[high[i]] = i*13;
else
hxw[high[i] +" "+ low[j]] = j + i * 13;
}
hxw["tret"] = 0;
map<string, int>::iterator it = hxw.begin();
int cou;
int num = 0;
string numb="\0";
cin >> cou;
cin.get();
for (int i = 0; i < cou; i++)
{
getline(cin,numb);
if (numb[0] >= '0' && numb[0] <= '9')//输入的是数字
{
for (int j = 0;j<numb.size();j++)
{
num *= 10;
num += numb[j] - '0';
}
if (num / 13 != 0 && num % 13 != 0)
cout << high[num / 13] << " " << low[num % 13] << endl;
else if (num == 0)
cout << "tret" << endl;
else if (num / 13 == 0)
cout << low[num % 13] << endl;
else
cout << high[num/13] << endl;
}
else//输入的是火星文
{
//it=hxw.find(numb);
cout<<hxw[numb]<<endl;
}
num = 0;
}
system("pause");
return 0;
}
//C++之路