#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef long double ld;
/*
#include <chrono>
using namespace std::chrono;
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<lli, null_type,less_equal<lli>, rb_tree_tag,tree_order_statistics_node_update>
//remove _equal from less_equal to make it ordered set , currently it is ordered_multiset
*/
#define pb push_back
const lli mod=1e9+7;
const lli mod1=998244353;
#define fir first
#define sec second
#define plli pair<lli,lli>
#define pplli pair<lli,plli>
/*
lli power(lli a, lli b) {
lli res = 1;
while (b > 0) {
if (b & 1)
res = res * a;
a = a * a;
b >>= 1;
}
return res;
}
lli powermod(lli a, lli b)
{
lli res = 1;
while (b > 0) {
if (b & 1)
res = ((res%mod)*(a%mod))%mod;
a = (a * a)%mod;
b >>= 1;
}
return res%mod;
}
*/
const lli N=200001;
vector<lli> v[N];
lli timer=1;
lli sub[N],a[N],in[N],val[N];
vector<lli> flat;
lli st[4*N],lazy[4*N];
lli dfs(lli node,lli par,lli x=0)
{
in[node]=timer;
timer++;
flat.pb(node);
sub[node]=1;
val[node]=x+a[node];
for(lli child:v[node])
{
if(child!=par)
{
dfs(child,node,x+a[node]);
sub[node]+=sub[child];
}
}
return 0;
}
lli build(lli ss,lli se,lli z)
{
if(ss==se)
{
st[z]=val[flat[ss]];
return 0;
}
lli mid=(ss+se)/2;
build(ss,mid,z*2);
build(mid+1,se,(z*2)+1);
st[z]=st[z*2]+st[z*2+1];
return 0;
}
void push(lli z)
{
st[z*2]+=lazy[z];
lazy[z*2]+=lazy[z];
st[z*2+1]+=lazy[z];
lazy[z*2+1]+=lazy[z];
lazy[z]=0;
}
lli update(lli ss,lli se,lli z,lli qs,lli qe,lli add)
{
if((ss>qe)||(se<qs))
return 0;
if((ss>=qs)and(se<=qe))
{
st[z]+=add;
lazy[z]+=add;
return 0;
}
push(z);
lli mid=(ss+se)/2;
update(ss,mid,z*2,qs,qe,add);
update(mid+1,se,z*2+1,qs,qe,add);
st[z]=st[z*2]+st[z*2+1];
return 0;
}
lli query(lli ss,lli se,lli z,lli qs)
{
if(ss==se)
return st[z];
lli mid=(ss+se)/2;
push(z);
if(qs<=mid)
return query(ss,mid,z*2,qs);
else
return query(mid+1,se,z*2+1,qs);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli T,i,j;
T=1;
while(T--)
{
flat.pb(0);
lli n,q,x,y;
cin>>n>>q;
for(i=1;i<=n;i++)
cin>>a[i];
for(i=0;i<n-1;i++)
{
cin>>x>>y;
v[x].pb(y);
v[y].pb(x);
}
dfs(1,0);
build(1,n,1);
while(q--)
{
lli r,s;
cin>>r;
if(r==1)
{
cin>>s>>x;
update(1,n,1,in[s],in[s]+sub[s]-1,x-a[s]);
a[s]=x;
}
else if(r==2)
{
cin>>s;
cout<<query(1,n,1,in[s])<<"\n";
}
}
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgaW50IGxsaTsKdHlwZWRlZiBsb25nIGRvdWJsZSBsZDsKLyoKI2luY2x1ZGUgPGNocm9ubz4gCnVzaW5nIG5hbWVzcGFjZSBzdGQ6OmNocm9ubzsKI2luY2x1ZGUgPGJvb3N0L211bHRpcHJlY2lzaW9uL2NwcF9pbnQuaHBwPiAKdXNpbmcgbmFtZXNwYWNlIGJvb3N0OjptdWx0aXByZWNpc2lvbjsKI2luY2x1ZGUgPGV4dC9wYl9kcy9hc3NvY19jb250YWluZXIuaHBwPiAKI2luY2x1ZGUgPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+IAp1c2luZyBuYW1lc3BhY2UgX19nbnVfcGJkczsgCiNkZWZpbmUgb3JkZXJlZF9zZXQgdHJlZTxsbGksIG51bGxfdHlwZSxsZXNzX2VxdWFsPGxsaT4sIHJiX3RyZWVfd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LGxsaSB4PTApCnsKICAgIGluW25vZGVdPXRpbWVyOwogICAgdGltZXIrKzsKICAgIGZsYXQucGIobm9kZSk7CiAgICBzdWJbbm9kZV09MTsKICAgIHZhbFtub2RlXT14K2Fbbm9kZV07CiAgICBmb3IobGxpIGNoaWxkOnZbbm9kZV0pCiAgICB7CiAgICAgICAgaWYoY2hpbGQhPXBhcikKICAgICAgICB7CiAgICAgICAgICAgIGRmcyhjaGlsZCxub2RlLHgrYVtub2RlXSk7CiAgICAgICAgICAgIHN1Yltub2RlXSs9c3ViW2NoaWxkXTsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gMDsKfQogCmxsaSBidWlsZChsbGkgc3MsbGxpIHNlLGxsaSB6KQp7CiAgICBpZihzcz09c2UpCiAgICB7CiAgICAgICAgc3Rbel09dmFsW2ZsYXRbc3NdXTsKICAgICAgICByZXR1cm4gMDsKICAgIH0KICAgIGxsaSBtaWQ9KHNzK3NlKS8yOwogICAgYnVpbGQoc3MsbWlkLHoqMik7CiAgICBidWlsZChtaWQrMSxzZSwoeioyKSsxKTsKICAgIHN0W3pdPXN0W3oqMl0rc3RbeioyKzFdOwogICAgcmV0dXJuIDA7Cn0KIAp2b2lkIHB1c2gobGxpIHopCnsKICAgIHN0W3oqMl0rPWxhenlbel07CiAgICBsYXp5W3oqMl0rPWxhenlbel07CiAgICBzdFt6KjIrMV0rPWxhenlbel07CiAgICBsYXp5W3oqMisxXSs9bGF6eVt6XTsKICAgIGxhenlbel09MDsKfQogCmxsaSB1cGRhdGUobGxpIHNzLGxsaSBzZSxsbGkgeixsbGkgcXMsbGxpIHFlLGxsaSBhZGQpCnsKICAgIGlmKChzcz5xZSl8fChzZTxxcykpCiAgICAgICAgcmV0dXJuIDA7CiAgICBpZigoc3M+PXFzKWFuZChzZTw9cWUpKQogICAgewogICAgICAgIHN0W3pdKz1hZGQ7CiAgICAgICAgbGF6eVt6XSs9YWRkOwogICAgICAgIHJldHVybiAwOwogICAgfQogICAgcHVzaCh6KTsKICAgIGxsaSBtaWQ9KHNzK3NlKS8yOwogICAgdXBkYXRlKHNzLG1pZCx6KjIscXMscWUsYWRkKTsKICAgIHVwZGF0ZShtaWQrMSxzZSx6KjIrMSxxcyxxZSxhZGQpOwogICAgc3Rbel09c3RbeioyXStzdFt6KjIrMV07CiAgICByZXR1cm4gMDsKfQogCmxsaSBxdWVyeShsbGkgc3MsbGxpIHNlLGxsaSB6LGxsaSBxcykKewogICAgaWYoc3M9PXNlKQogICAgICAgIHJldHVybiBzdFt6XTsKICAgIGxsaSBtaWQ9KHNzK3NlKS8yOwogICAgcHVzaCh6KTsKICAgIGlmKHFzPD1taWQpCiAgICAgICAgcmV0dXJuIHF1ZXJ5KHNzLG1pZCx6KjIscXMpOwogICAgZWxzZQogICAgICAgIHJldHVybiBxdWVyeShtaWQrMSxzZSx6KjIrMSxxcyk7Cn0KIAppbnQgbWFpbigpCnsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZShOVUxMKTsKICAgIGxsaSBULGksajsKICAgIFQ9MTsKICAgIHdoaWxlKFQtLSkKICAgIHsKICAgICAgICBmbGF0LnBiKDApOwogICAgICAgIGxsaSBuLHEseCx5OwogICAgICAgIGNpbj4+bj4+cTsKICAgICAgICBmb3IoaT0xO2k8PW47aSsrKQogICAgICAgICAgICBjaW4+PmFbaV07CiAgICAgICAgZm9yKGk9MDtpPG4tMTtpKyspCiAgICAgICAgewogICAgICAgICAgICBjaW4+Png+Pnk7CiAgICAgICAgICAgIHZbeF0ucGIoeSk7CiAgICAgICAgICAgIHZbeV0ucGIoeCk7CiAgICAgICAgfQogICAgICAgIGRmcygxLDApOwogICAgICAgIGJ1aWxkKDEsbiwxKTsKICAgICAgICB3aGlsZShxLS0pCiAgICAgICAgewogICAgICAgICAgICBsbGkgcixzOwogICAgICAgICAgICBjaW4+PnI7CiAgICAgICAgICAgIGlmKHI9PTEpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGNpbj4+cz4+eDsKICAgICAgICAgICAgICAgIHVwZGF0ZSgxLG4sMSxpbltzXSxpbltzXStzdWJbc10tMSx4LWFbc10pOwogICAgICAgICAgICAgICAgYVtzXT14OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgaWYocj09MikKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgY2luPj5zOwogICAgICAgICAgICAgICAgY291dDw8cXVlcnkoMSxuLDEsaW5bc10pPDwiXG4iOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIDA7Cn0KIAogCiA=