#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector> g(n); string s; for(int i = 0; i < n; i++){ for(int j = 0; j < 4; j++){ cin >> s; if(s[0] != 'H'){ int v = stoi(s) - 1; g[i].emplace_back(v); } } } auto dfs = [&](auto dfs, int v, int p) -> void { for(auto &&u : g[v]){ if(u == p) continue; cout << '('; dfs(dfs, u, v); cout << ')'; } cout << (p != -1 ? "methyl" : "methane\n"); }; dfs(dfs, 0, -1); }