rt,我的代码如下:
#include <bits/stdc++.h>
using namespace std;
int a[1000010];
int main(){
int t;
cin>>t;
while(t--){
int cmd;
cin>>cmd;
if(cmd == 1){
int x,y;
cin>>x>>y;
a[x] = y;
}else if(cmd == 2){
int x;
cin>>x;
cout<<a[x]<<endl;
}else if(cmd == 3){
int x;
cin>>x;
a[x] = a[a[x]];
}
}
return 0;
}