C++#include<bits/stdc++.h>
using namespace std;
const int N=1000000007;
int n,m,q;
long long a[100005],u,v,heigt[100005];
vector<int> s[100005];
void gen(int x,int from)
{
for(auto j : s[x])
{
if(j==from) continue;
heigt[j]=heigt[x]+1;
gen(j,x);
}
}
void dfs(int x,int y)
{
for(auto e : s[x])
{
if(heigt[e]<heigt[x])
{
a[e]+=y;
a[e]%=N;
dfs(e,y);
}
}
}
void dfs1(int x,int y)
{
for(auto e : s[x])
{
if(heigt[e]>heigt[x])
{
a[e]+=y;
a[e]%=N;
dfs1(e,y);
}
}
}
int main()
{
cin>>n>>m>>q;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int i=1;i<n;i++)
{
cin>>u>>v;
s[u].push_back(v);
s[v].push_back(u);
}
heigt[1]=0;
gen(1,-1);
// for(int i=1;i<=n;i++)
// {
// cout<<heigt[i]<<' ';
// }
// cout<<endl;
for(int i=1;i<=m;i++)
{
cin>>u>>v;
s[u].push_back(v);
s[v].push_back(u);
}
while(q--)
{
int opt,w,k;
cin>>opt>>w>>k;
if(opt==1)
{
a[w]+=k;
a[w]%=N;
dfs(w,k);
}
else
{
a[w]=(a[w]+k)%N;
dfs1(w,k);
}
// cout<<endl;
// for(int i=1;i<=n;i++)
// {
// cout<<a[i]%N<<' ';
// }
// cout<<endl;
}
for(int i=1;i<=n;i++)
{
printf("%lld ",a[i]%N);
}
return 0;
}
//1000000007