//submitted by HimJ
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;
const ll range=100005;
vector<ll> tree[range];
ll par[range],st[4*range],tin[range],depth[range],child[range],chain[range],head[range];
ll timer=0,c=0,n;
void dfs(ll u,ll p,ll d)
{
depth[u]=d;
child[u]=1;
for(ll v:tree[u])
{
if(v==p)
continue;
dfs(v,u,d+1);
par[v]=u;
child[u]+=child[v];
}
}
void hld(ll u,ll p)
{
if(head[c]==-1)
head[c]=u;
chain[u]=c;
tin[u]=++timer;
ll special=-1;
for(ll v:tree[u])
{
if(v==p)
continue;
if(special==-1||child[special]<child[v])
special=v;
}
if(special!=-1)
hld(special,u);
for(ll v:tree[u])
{
if(v==p||v==special)
continue;
c++;
hld(v,u);
}
}
ll lca(ll u,ll v,vector<bool> vis)
{
if(depth[u]<depth[v])
swap(u,v);
while(u!=-1)
{
vis[u]=1;
u=par[u];
}
while(1)
{
if(vis[v])
return v;
v=par[v];
}
return 1;
}
ll query(ll ss,ll se,ll si,ll l,ll r)
{
if(l<=ss&&r>=se)
return st[si];
if(l>se||r<ss)
return 0;
ll mid=(ss+se)>>1;
return max(query(ss,mid,si+si,l,r),query(mid+1,se,si+si+1,l,r));
}
ll crawl(ll u,ll v)
{
ll ans=0;
while(1)
{
if(chain[u]==chain[v])
{
return max(ans,query(1,n,1,tin[v],tin[u]));
}
ans=max(ans,query(1,n,1,tin[head[chain[u]]],tin[u]));
u=par[head[chain[u]]];
}
return ans;
}
ll ans(ll u,ll v,vector<bool> vis)
{
ll ans=lca(u,v,vis);
return max(crawl(u,ans),crawl(v,ans));
}
ll update(ll ss,ll se,ll si,ll i,ll val)
{
if(i>se||i<ss)
return 0;
if(se==ss)
return st[si]+=val;
ll mid=(ss+se)>>1;
return st[si]=max(update(ss,mid,si+si,i,val),update(mid+1,se,si+si+1,i,val));
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t=1;
//cin>>t;
while(t--){
ll i,u,v,q;
cin>>n;
fr(i,0,n-1)
{
cin>>u>>v;
tree[u].pb(v);
tree[v].pb(u);
par[i+1]=head[i+1]=-1;
}
ms(st,0);
dfs(1,1,0);
par[1]=-1;
hld(1,1);
cin>>q;
vector<bool> vis(range,0);
while(q--)
{
char g;
cin>>g>>u>>v;
if(g=='I')
update(1,n,1,tin[u],v);
else
cout<<ans(u,v,vis)<<"\n";
// fr(i,0,2*timer)
// cout<<st[i]<<" ";
// cout<<"\n";
}
}
return 0;
}
Ly9zdWJtaXR0ZWQgYnkgSGltSgojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lIG1vZCAxMDAwMDAwMDA3CiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgZmkgZmlyc3QKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBmcihpLHMsZSkgZm9yKGk9cztpPGU7aSsrKQojZGVmaW5lIG1zKGFycix2YWwpIG1lbXNldChhcnIsdmFsLHNpemVvZihhcnIpKQp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBsbCByYW5nZT0xMDAwMDU7CnZlY3RvcjxsbD4gdHJlZVtyYW5nZV07CmxsIHBhcltyYW5nZV0sc3RbNCpyYW5nZV0sdGluW3JhbmdlXSxkZXB0aFtyYW5nZV0sY2hpbGRbcmFuZ2VdLGNoYWluW3JhbmdlXSxoZWFkW3JhbmdlXTsKbGwgdGltZXI9MCxjPTAsbjsKdm9pZCBkZnMobGwgdSxsbCBwLGxsIGQpCnsKICAgIGRlcHRoW3VdPWQ7CiAgICBjaGlsZFt1XT0xOwogICAgZm9yKGxsIHY6dHJlZVt1XSkKICAgIHsKICAgICAgICBpZih2PT1wKQogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICBkZnModix1LGQrMSk7CiAgICAgICAgcGFyW3ZdPXU7CiAgICAgICAgY2hpbGRbdV0rPWNoaWxkW3ZdOwogICAgfQp9CnZvaWQgaGxkKGxsIHUsbGwgcCkKewogICAgaWYoaGVhZFtjXT09LTEpCiAgICAgICAgaGVhZFtjXT11OwogICAgY2hhaW5bdV09YzsKICAgIHRpblt1XT0rK3RpbWVyOwogICAgbGwgc3BlY2lhbD0tMTsKICAgIGZvcihsbCB2OnRyZWVbdV0pCiAgICB7CiAgICAgICAgaWYodj09cCkKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgaWYoc3BlY2lhbD09LTF8fGNoaWxkW3NwZWNpYWxdPGNoaWxkW3ZdKQogICAgICAgICAgICBzcGVjaWFsPXY7CiAgICB9CiAgICBpZihzcGVjaWFsIT0tMSkKICAgICAgICBobGQoc3BlY2lhbCx1KTsKICAgIGZvcihsbCB2OnRyZWVbdV0pCiAgICB7CiAgICAgICAgaWYodj09cHx8dj09c3BlY2lhbCkKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgYysrOwogICAgICAgIGhsZCh2LHUpOwogICAgfQp9CmxsIGxjYShsbCB1LGxsIHYsdmVjdG9yPGJvb2w+IHZpcykKewogICAgaWYoZGVwdGhbdV08ZGVwdGhbdl0pCiAgICAgICAgc3dhcCh1LHYpOwogICAgd2hpbGUodSE9LTEpCiAgICB7CiAgICAgICAgdmlzW3VdPTE7CiAgICAgICAgdT1wYXJbdV07CiAgICB9CiAgICB3aGlsZSgxKQogICAgewogICAgICAgIGlmKHZpc1t2XSkKICAgICAgICAgICAgcmV0dXJuIHY7CiAgICAgICAgdj1wYXJbdl07CiAgICB9CiAgICByZXR1cm4gMTsKfQpsbCBxdWVyeShsbCBzcyxsbCBzZSxsbCBzaSxsbCBsLGxsIHIpCnsKICAgIGlmKGw8PXNzJiZyPj1zZSkKICAgICAgICByZXR1cm4gc3Rbc2ldOwogICAgaWYobD5zZXx8cjxzcykKICAgICAgICByZXR1cm4gMDsKICAgIGxsIG1pZD0oc3Mrc2UpPj4xOwogICAgcmV0dXJuIG1heChxdWVyeShzcyxtaWQsc2krc2ksbCxyKSxxdWVyeShtaWQrMSxzZSxzaStzaSsxLGwscikpOwp9CmxsIGNyYXdsKGxsIHUsbGwgdikKewogICAgbGwgYW5zPTA7CiAgICB3aGlsZSgxKQogICAgewogICAgICAgIGlmKGNoYWluW3VdPT1jaGFpblt2XSkKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBtYXgoYW5zLHF1ZXJ5KDEsbiwxLHRpblt2XSx0aW5bdV0pKTsKICAgICAgICB9CiAgICAgICAgYW5zPW1heChhbnMscXVlcnkoMSxuLDEsdGluW2hlYWRbY2hhaW5bdV1dXSx0aW5bdV0pKTsKICAgICAgICB1PXBhcltoZWFkW2NoYWluW3VdXV07CiAgICB9CiAgICByZXR1cm4gYW5zOwp9CmxsIGFucyhsbCB1LGxsIHYsdmVjdG9yPGJvb2w+IHZpcykKewogICAgbGwgYW5zPWxjYSh1LHYsdmlzKTsKICAgIHJldHVybiBtYXgoY3Jhd2wodSxhbnMpLGNyYXdsKHYsYW5zKSk7Cn0KbGwgdXBkYXRlKGxsIHNzLGxsIHNlLGxsIHNpLGxsIGksbGwgdmFsKQp7CiAgICBpZihpPnNlfHxpPHNzKQogICAgICAgIHJldHVybiAwOwogICAgaWYoc2U9PXNzKQogICAgICAgIHJldHVybiBzdFtzaV0rPXZhbDsKICAgIGxsIG1pZD0oc3Mrc2UpPj4xOwogICAgcmV0dXJuIHN0W3NpXT1tYXgodXBkYXRlKHNzLG1pZCxzaStzaSxpLHZhbCksdXBkYXRlKG1pZCsxLHNlLHNpK3NpKzEsaSx2YWwpKTsKfQppbnQgbWFpbigpewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKDApOwogICAgY291dC50aWUoMCk7CiAgbGwgdD0xOwogIC8vY2luPj50OwogICAgd2hpbGUodC0tKXsKICAgICAgICAgICAgbGwgaSx1LHYscTsKICAgICAgICAgICAgY2luPj5uOwogICAgICAgICAgICBmcihpLDAsbi0xKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBjaW4+PnU+PnY7CiAgICAgICAgICAgICAgICB0cmVlW3VdLnBiKHYpOwogICAgICAgICAgICAgICAgdHJlZVt2XS5wYih1KTsKICAgICAgICAgICAgICAgIHBhcltpKzFdPWhlYWRbaSsxXT0tMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBtcyhzdCwwKTsKICAgICAgICAgICAgZGZzKDEsMSwwKTsKICAgICAgICAgICAgcGFyWzFdPS0xOwogICAgICAgICAgICBobGQoMSwxKTsKICAgICAgICAgICAgY2luPj5xOwogICAgICAgICAgICB2ZWN0b3I8Ym9vbD4gdmlzKHJhbmdlLDApOwogICAgICAgICAgICB3aGlsZShxLS0pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGNoYXIgZzsKICAgICAgICAgICAgICAgIGNpbj4+Zz4+dT4+djsKICAgICAgICAgICAgICAgIGlmKGc9PSdJJykKICAgICAgICAgICAgICAgICAgICB1cGRhdGUoMSxuLDEsdGluW3VdLHYpOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIGNvdXQ8PGFucyh1LHYsdmlzKTw8IlxuIjsKLy8JZnIoaSwwLDIqdGltZXIpCi8vCWNvdXQ8PHN0W2ldPDwiICI7Ci8vCWNvdXQ8PCJcbiI7CiAgICAgICAgICAgIH0KICB9CiAgcmV0dXJuIDA7CiAgfQoK