#include using namespace std; #define int long long #define rep(i,n) for(int i=0;i=0;i--) #define all(v) v.begin(),v.end() #define P pair #define len(s) (int)s.size() template inline bool chmin(T &a, T b){ if(a>b){a=b;return true;} return false; } template inline bool chmax(T &a, T b){ if(a struct Segtree{ int size=1; vectordat; vectorlazy; const F f; const G g; const H h; Monoid M; OperatorMonoid OM; void set(int a,Monoid x){ dat[a+size-1]=x; } void init(){ for(int i=size-2;i>=0;i--){ dat[i]=f(dat[i*2+1],dat[i*2+2]); } } void eval(int k,int l,int r){ if(lazy[k]!=OM){ dat[k]=g(dat[k],lazy[k],(r-l)); if(r-l>1){ lazy[2*k+1]=h(lazy[2*k+1],lazy[k]); lazy[2*k+2]=h(lazy[2*k+2],lazy[k]); } lazy[k]=OM; } } void update(int a,int b,OperatorMonoid M,int k=0,int l=0,int r=-1){ if(r==-1)r=size; eval(k,l,r); if(r<=a||b<=l)return; if(a<=l&&r<=b){ lazy[k]=h(lazy[k],M); eval(k,l,r); return; } update(a,b,M,k*2+1,l,(l+r)/2); update(a,b,M,k*2+2,(l+r)/2,r); dat[k]=f(dat[k*2+1],dat[k*2+2]); } Monoid query(int a,int b,int k=0,int l=0,int r=-1){ if(r==-1)r=size; eval(k,l,r); if(r<=a||b<=l)return M; if(a<=l&&r<=b)return dat[k]; Monoid lv=query(a,b,k*2+1,l,(l+r)/2); Monoid rv=query(a,b,k*2+2,(l+r)/2,r); return f(lv,rv); } Segtree(int x,F f,G g,H h,Monoid M,OperatorMonoid OM) :f(f),g(g),h(h),M(M),OM(OM){ while(size>; struct heavy_set{ vectorele; int depth,par,cost1=0,cost2=0; heavy_set(int v,int d,int par) :ele(1,v),depth(d),par(par){} }; vector>G; vectorS; vectorsubsize,stidx,eleidx; int subtree(int v,int p){ int &sz=subsize[v]; if(sz)return sz; sz=1; for(int i:G[v])if(i!=p)sz+=subtree(i,v); return sz; } void make_path(int v,int p,int id){ stidx[v]=id; eleidx[v]=S[id].ele.size()-1; int mxidx,mx=0; for(int i:G[v])if(i!=p){ if(mx>&G):G(G){ int N=G.size(); subsize.resize(N); eleidx.resize(N); stidx.resize(N); S.emplace_back(0,0,0); make_path(0,0,0); } }; int N,K,Q; int C[100005],par[100005],cnt[100005],dis[100005]; vector>G; void dfs(int x,int p){ if(p)par[x]=par[p]; else par[x]=x; for(int i:G[x])if(i!=p){ dis[i]=dis[x]+1; dfs(i,x); } } signed main(){ cin>>N>>K>>Q;G.resize(N); //Size Check assert(N<=1e5&&K<=1e5&&Q<=1e5); assert(N>=1&&K>=1&&Q>=1); rep(i,K){cin>>C[i];C[i]--;} rep(i,N-1){ int a,b;cin>>a>>b;a--;b--; assert(0<=a&&0<=b&&a!=b); assert(a>segtrees; rep(i,len(hld.S))segtrees.emplace_back(len(hld.S[i].ele),f,g,h,0,0); auto add=[&](int a,int x){ while(hld.st(a)!=0){ segtrees[hld.st(a)].update(0,hld.el(a),x); hld.S[hld.st(a)].cost1+=x; a=hld.S[hld.st(a)].par; } segtrees[0].update(0,hld.el(a),x); }; auto query=[&](int a){ int res=0; while(hld.st(a)!=0){ res+=segtrees[hld.st(a)].query(0,hld.el(a)); res+=hld.S[hld.st(a)].cost1; a=hld.S[hld.st(a)].par; } return res+segtrees[0].query(0,hld.el(a)); }; int ans=0; rep(i,K){ add(C[i],1); cnt[par[C[i]]]++; ans+=dis[C[i]]; } for(auto i:segtrees)i.init(); while(Q--){ int type;cin>>type; //type check assert(type==1||type==2); if(type==1){ int p,d;cin>>p>>d;p--;d--; assert(0<=p&&p>e;e--; assert(0<=e&&e