#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
//#include <unordered_map>
#include <map>

using namespace std;

#define debug(x) cout<<#x<<": "<<(x)<<endl;
#pragma warning(disable:4996)


int main() {


//pop, no, zip, zotz, tzec, xul, yoxkin, mol, chen
//, yax, zac, ceh, mac, kankin, muan, pax, koyab, cumhu, uayet

map<string, int> Hamp;
Hamp["pop"] = 0,
Hamp["no"] = 20,
Hamp["zip"] = 40,
Hamp["zotz"] = 60,
Hamp["tzec"] = 80,
Hamp["xul"] = 100,
Hamp["yoxkin"] = 120,
Hamp["mol"] = 140,
Hamp["chen"] = 160,
Hamp["yax"] = 180,
Hamp["zac"] = 200,
Hamp["ceh"] = 220,
Hamp["mac"] = 240,
Hamp["kankin"] = 260,
Hamp["muan"] = 280,
Hamp["pax"] = 300,
Hamp["koyab"] = 320,
Hamp["cumhu"] = 340,
Hamp["uayet"] = 360;

// imix, ik, akbal, kan, chicchan, cimi, manik,
//lamat, muluk, ok, chuen, eb, ben, ix, mem, cib, caban, eznab, canac, ahau

string Tzolkin[30] = {"",
"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk",
"ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" };

//freopen("../in1.txt", "r", stdin);

long long n = 0;
cin >> n;
cout << n << endl;
for (long long i = 0; i < n; ++i) {
long long d;
string m;
long long y;
cin >> d;
cin >> m;
cin >> m;
cin >> y;
long long sd = y * 365 + Hamp [m]+ d;
//debug(sd)
//sd += 1;

long long nd = ( sd % 13) + 1;

//int mc = sd / 20 + (sd % 20 != 0);
long long nm = (sd % 20) + 1;

long long ny = (sd) / 260;

cout << nd << " " << Tzolkin[nm] << " " << ny << endl;
/*
3
3 chuen 0
1 imix 0
9 cimi 2801
*/
}

return 0;
}

POJ Maya Calendar 【日历转换 模拟】取模需要注意_ios