#include #include #include #include #include #include void solve() { int n; std::cin >> n; std::vector> tree(n); for(const int i : std::views::iota(0, n)) { for([[maybe_unused]] const int _ : std::views::iota(0, 4)) { std::string c; std::cin >> c; if(c == "H") continue; tree[i].emplace_back(std::stoi(c) - 1); } } std::string ans; auto dfs = [&](auto&& dfs, int v, int p) -> void { for(const int nv : tree[v]) { if(nv < 0 || nv == p) continue; ans += "("; dfs(dfs, nv, v); ans += "yl)"; } ans += "meth"; }; dfs(dfs, n - 1, -1); std::cout << ans + "ane\n"; } int main() { solve(); return 0; } __attribute__((constructor)) inline void fast_io() { std::ios::sync_with_stdio(false), std::cin.tie(nullptr); }