#include using namespace std; int main() { int n; cin >> n; vector to(n, vector()); for (int i = 0; i < n; i++) { for (int j = 0; j < 4; j++) { string s; cin >> s; if (s == "H") continue; int k = stoi(s); k--; // cerr << "edge " << i << " to " << k << endl; to[i].emplace_back(k); } } for (int i = 0; i < n; i++) { // cerr << to[i].size() << endl; } string ans; auto dfs = [&](auto&& self, int v, int p) -> void { // cerr << "v " << v << endl; for (auto u : to[v]) { // cerr << "u " << u << " " << p << endl; if (u == p) continue; ans += "("; self(self, u, v); ans.erase(ans.begin() + ans.size() - 3, ans.end()); ans += "yl)"; } // cerr << "v " << v << " " << ans << endl; ans += "methane"; }; dfs(dfs, 0, -1); cout << ans << endl; }