神秘rope
#include<ext/rope>
using namespace __gnu_cxx;
vector<rope<char>>px;
rope<char>st;
void solve(){
int n,q;cin>>n>>q;
px.resize(n+1);
while(q--){
int opt;cin>>opt;
int p;cin>>p;
if(opt==1){
px[p]=st;
}else if(opt==2){
string s;cin>>s;
for(auto ch:s)px[p].pb(ch);
}else{
st=px[p];
}
}
for(auto ch:st){cout<<ch;}
}

浙公网安备 33010602011771号