/**
* Author: Sergey Kopeliovich (Burunduk30@gmail.com)
* Date: 2015.03.02
*/
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector <int> vi;
const int N = 1e5;
const int K = 17;
int n, x[N], d[N], p[N];
vi c[N];
int T, t_in[N], t_out[N];
int up[N][K];
int size[N];
int cnt, no[N], pos[N], len[N], top[N];
/** Begin fast allocation */
const int MAX_MEM = 1e8;
int mpos = 0;
char mem[MAX_MEM];
inline void * operator new ( size_t n ) {
char *res = mem + mpos;
mpos += n;
assert(mpos <= MAX_MEM);
return (void *)res;
}
inline void operator delete ( void * ) { }
/** End fast allocation */
int cntTime = 0;
struct SegmentTree {
int n, *t;
int lastChangedTime, *lastQueryTime, currentTime, *ans;
void build( int n ) {
this->n = n;
t = new int[2 * n]();
lastQueryTime = new int[n]();
ans = new int[n]();
lastChangedTime = 0;
currentTime = 0;
}
int getMax( int l, int r ) {
if (l == 0 && lastChangedTime <= lastQueryTime[r])
return ans[r];
cntTime++;
int res = 0, r0 = r;
for (l += n, r += n; l <= r; l >>= 1, r >>= 1) {
if ((l & 1) == 1) res = max(res, t[l++]);
if ((r & 1) == 0) res = max(res, t[r--]);
}
if (l == 0) {
lastQueryTime[r0] = ++currentTime;
ans[r0] = res;
}
return res;
}
void change( int i, int x ) {
t[i += n] = x;
for (i >>= 1; i > 0; i >>= 1)
t[i] = max(t[2 * i], t[2 * i + 1]);
lastChangedTime = ++currentTime;
}
} s[N];
void dfs( int v, int pr, int dep = 0 ) {
t_in[v] = T++;
p[v] = pr;
d[v] = dep;
size[v] = 1;
for (int x : c[v])
if (x != pr)
dfs(x, v, dep + 1), size[v] += size[x];
t_out[v] = T++;
}
// no[v] -- Номер пути, соответствующего вершине v
// pos[v] -- Позиция вершины v в пути
// pr, p[v] -- Отец вершины v
// top[path] -- Верхняя вершина пути path
// len[path] -- Длина пути path
void calc( int v, int pr ) {
// V --> ... --> Root
if (v == pr || 2 * size[v] <= size[pr])
no[v] = cnt++, top[no[v]] = v;
else
no[v] = no[pr];
pos[v] = len[no[v]]++;
for (int x : c[v])
if (x != pr)
calc(x, v);
}
int getMax( int a, int lca ) {
int res = 0; // x[a] -- вес пути, но пользоваться мы им не будем!
while (no[a] != no[lca]) {
// p[top[no[a]]], (0, 1, .... pos[a], ....)
res = max(res, s[no[a]].getMax(0, pos[a]));
a = p[top[no[a]]];
}
return max(res, s[no[a]].getMax(pos[lca], pos[a]));
}
int isAncestor( int a, int b ) {
return t_in[a] <= t_in[b] && t_out[b] <= t_out[a];
}
int getLca( int a, int b ) {
for (int k = K - 1; k >= 0; k--)
if (!isAncestor(up[a][k], b))
a = up[a][k];
return isAncestor(a, b) ? a : p[a];
}
inline int readChar();
template <class T = int> inline T readInt(); // skip spaces, read signed int
template <class T> inline void writeInt( T x );
inline void writeChar( int x ); // you may use putchar() instead of it
inline void flush();
int main() {
#define NAME "caves"
assert(freopen(NAME ".in", "r", stdin));
assert(freopen(NAME ".out", "w", stdout));
n = readInt();
forn(i, n - 1) {
int a = readInt() - 1;
int b = readInt() - 1;
c[a].pb(b), c[b].pb(a);
}
dfs(0, 0);
calc(0, 0);
forn(i, n)
s[i].build(len[i]);
forn(i, n)
up[i][0] = p[i];
forn(k, K - 1)
forn(i, n)
up[i][k + 1] = up[up[i][k]][k];
int q = readInt();
while (q-- > 0) {
char com = readChar();
int a = readInt();
int b = readInt();
if (com == 'G') {
int lca = getLca(--a, --b);
writeInt(max(getMax(a, lca), getMax(b, lca)));
writeChar('\n');
} else {
--a;
x[a] += b;
s[no[a]].change(pos[a], x[a]);
}
}
flush();
fprintf(stderr, "time = %.2f\n", 1. * clock() / CLOCKS_PER_SEC); // stamp
fprintf(stderr, "cnt = %d\n", cntTime);
return 0;
}
/** Read */
static const int buf_size = 4096;
inline int getchar_fast() { // you may use getchar() instead of it
static char buf[buf_size];
static int len = 0, pos = 0;
if (pos == len)
pos = 0, len = fread(buf, 1, buf_size, stdin);
if (pos == len)
return -1;
return buf[pos++];
}
inline int readChar() {
int c = getchar_fast();
while (c <= 32)
c = getchar_fast();
return c;
}
template <class T>
inline T readInt() {
int s = 1, c = readChar();
T x = 0;
if (c == '-')
s = -1, c = getchar_fast();
while ('0' <= c && c <= '9')
x = x * 10 + c - '0', c = getchar_fast();
return s == 1 ? x : -x;
}
/** Write */
static int write_pos = 0;
static char write_buf[buf_size];
inline void writeChar( int x ) {
if (write_pos == buf_size)
fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
write_buf[write_pos++] = x;
}
inline void flush() {
if (write_pos)
fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
}
template <class T>
inline void writeInt( T x ) {
if (x < 0)
writeChar('-'), x = -x;
char s[24];
int n = 0;
while (x || !n)
s[n++] = '0' + x % 10, x /= 10;
while (n--)
writeChar(s[n]);
}