#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
const int MX = 1e5 + 10;
const ll mod = 1e9 + 7;
int tt, tin[MX], tout[MX], vs[MX], Arr[MX];
ll tree[MX];
vector<int> G[MX];
void init(){
memset(Arr, 0, sizeof(Arr));
memset(tree, 0, sizeof(tree));
for(int i = 0; i < MX; i++) G[i].clear();
}
void dfs(int v, int p){
vs[++tt] = v;
tin[v] = tt;
for(int i = 0; i < G[v].size(); i++){
if(G[v][i] != p) dfs(G[v][i], v);
}
tout[v] = tt;
}
void update(int node, int val){
for(; node < MX ; tree[node] = ((tree[node] % mod) + (val % mod)) % mod, node += node & -node);
}
ll query(int node){
ll Ans = 0;
for(; node > 0 ; Ans = ((Ans % mod) + (tree[node] % mod)) % mod, node -= node & -node);
return Ans;
}
int main() {
int t, n, q, u, v, id;
scanf("%d", &t);
for(int i = 1; i <= t; i++){
scanf("%d", &n);
init();
for(int j = 1; j < n; j++){
scanf("%d %d", &u, &v);
G[u].push_back(v);
G[v].push_back(u);
}
tt = 0;
dfs(1, -1);
scanf("%d", &q);
printf("Case %d:\n", i);
for(int j = 1; j <= q; j++){
scanf("%d", &id);
if(id == 1){
scanf("%d", &u);
ll Ans = query(tout[u]) - query(tin[u] - 1);
if(Ans < 0) Ans += mod;
printf("%lld\n", Ans);
}else{
scanf("%d %d", &u, &v);
update(vs[u], v);
}
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIHNpZ25lZCBsb25nIGxvbmcgbGw7CmNvbnN0IGludCBNWCA9IDFlNSArIDEwOwpjb25zdCBsbCBtb2QgPSAxZTkgKyA3OwppbnQgdHQsIHRpbltNWF0sIHRvdXRbTVhdLCB2c1tNWF0sIEFycltNWF07CmxsIHRyZWVbTVhdOwp2ZWN0b3I8aW50PiBHW01YXTsKCnZvaWQgaW5pdCgpewoJbWVtc2V0KEFyciwgMCwgc2l6ZW9mKEFycikp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