#include <cstdio>#include <iostream>#include <sstream>#include <cstdlib>#include <string>#include <vector>#include <set>#include <queue>#include <stack>#include <list>#include <cmath>#include <algorithm>#include <map>#include <ctype.h>using namespace std;string first[] = {"Jia", "Yi", "Bing", "Ding", "Wu", "Ji", "Geng", "Xin", "Ren", "Gui"};string second[] = {"zi", "chou", "yin", "mao", "chen", "si", "wu", "wei", "shen", "you", "xu", "hai"};void solve(){int year;cin >> year;int nowYear = 1911;int nowf = 7;int nows = 11;if(year >= nowYear){int diff = year - nowYear;cout << first[(diff + nowf) % 10] << second[(diff + nows) % 12] << endl;} else {if(year < 0) year++;int diff = nowYear - year;cout << first[(((nowf - diff) % 10) + 10) % 10] << second[(((nows - diff) % 12) + 12) % 12] << endl;}}int main(){int test = 0;cin >> test;for(int tt = 0; tt < test; tt++ )solve();return 0;}


