# include <stdio.h>
# include <algorithm>
# include <string.h>
# include <vector>
# define N 100005
using namespace std;
vector<int>g[N];
int node[N];
int slove(int x)
{
int sum=0,i;
for(i=0;i<g[x].size();i++)
{
sum+=node[g[x][i]];
}
return sum;
}
int main()
{
int t,a,b,c,n,m,q,i;
while(~scanf("%d",&t))
{
while(t--)
{
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)
{
g[i].clear();
node[i]=0;
}
while(m--)
{
scanf("%d%d",&a,&b);
g[a].push_back(b);
g[b].push_back(a);
}
scanf("%d",&q);
while(q--)
{
scanf("%d",&a);
if(a==0)
{
scanf("%d%d",&b,&c);
node[b]+=c;
}
else
{
scanf("%d",&c);
printf("%d\n",slove(c));
}
}
}
}
return 0;
}