#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using ull = unsigned long long; using Matrix = std::vector>; const int inf = 1000000000; const ll INF = 1000000000000000000; const ll mod = 998244353; const ull mod_hash = (1UL << 61) - 1; const std::vector dx = {0, 1, 0, -1, 1, 1, -1, -1}; const std::vector dy = {1, 0, -1, 0, 1, -1, 1, -1}; template struct Edge{ int from, to, id; T cost; Edge(int from, int to, int id, T cost): from(from), to(to), id(id), cost(cost){} }; template class WeightedGraph{ public: WeightedGraph(int N): N(N), G(N){} void add_edge(int u, int v, int id, T cost, int zero_indexed = 0, int directed = 0){ if (!zero_indexed) {u--; v--;} G[u].emplace_back(u, v, id, cost); if(!directed)G[v].emplace_back(v, u, id, cost); } int size()const{return G.size();}; const std::vector>& operator[](int i)const{return G[i];}; private: int N; std::vector>> G; }; class UnweightedGraph{ public: UnweightedGraph(int N): N(N), G(N){} void read_edge(int zero_indexed = 0, int directed = 0){ int u, v; std::cin >> u >> v; add_edge(u, v, zero_indexed, directed); } void add_edge(int u, int v, int zero_indexed = 0, int directed = 0){ if (!zero_indexed) {u--; v--;} G[u].push_back(v); if(!directed)G[v].push_back(u); } int size()const{return G.size();}; const std::vector& operator[](int i)const{return G[i];}; private: int N; std::vector> G; }; string dfs(UnweightedGraph &G, int n, int p){ string res = "meth"; string tmp = ""; for(int nxt : G[n]){ if (nxt == p) continue; tmp += "(" + dfs(G, nxt, n) + "yl)"; } tmp += res; return tmp; } int main(){ int N; cin >> N; UnweightedGraph G(N); for(int i = 0; i < N; i++){ for(int j = 0; j < 4; j++){ string c; cin >> c; if (c != "H"){ int v = stoi(c) - 1; G.add_edge(i, v, 1, 1); } } } cout << dfs(G, 0, -1) + "ane"<< endl; return 0; }