#include using namespace std; typedef long long ll; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b G[MAX]; void DFS(int u,int p){ if(u==0){ for(int to:G[u]){ if(to==p) continue; cout<<'('; DFS(to,u); cout<<')'; } cout<<"methane\n"; }else{ for(int to:G[u]){ if(to==p) continue; cout<<'('; DFS(to,u); cout<<')'; } cout<<"methyl"; } } int main(){ std::ifstream in("text.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); int N;cin>>N; for(int i=0;i>S; if(S=="H") continue; int z=stoi(S);z--; G[i].push_back(z); } } if(N==1){ cout<<"methane\n"; return 0; } DFS(0,-1); return 0; }