#include <bits/stdc++.h>
#pragma gcc optimize("O2")
#pragma g++ optimize("O2")
#define int long long
#define endl '
'
using namespace std;
const int N = 2e5 + 10, MOD = 1e9 + 7;
namespace LCT{
struct Info{
int ans, lc, rc, xc, ctag;
void init_color(int c) { lc = rc = xc = c, ans = 1; }
}tree[N];
int ch[N][2], f[N], tag[N];
#define ls ch[x][0]
#define rs ch[x][1]
inline void push_reverse(int x) { swap(ls, rs), swap(tree[x].lc, tree[x].rc), tag[x] ^= 1; }
inline void push_color(int x, int c) { tree[x].init_color(c); tree[x].ctag = c; }
inline void push_down(int x)
if(tag[x])
}
inline void push_up(int x)
#define get(x) (ch[f[x]][1] == x)
#define isRoot(x) (ch[f[x]][0] != x && ch[f[x]][1] != x)
void rotate(int x)
void update(int x)
void splay(int x)
push_up(x);
}
int access(int x) {
int p;
for(p = 0; x; x = f[p = x]) splay(x), rs = p, push_up(x);
return p;
}
void makeRoot(int x) { access(x), splay(x), push_reverse(x); }
int findRoot(int x) {
access(x), splay(x);
while(ch[x][0]) push_down(x), x = ch[x][0];
splay(x);
return x;
}
void split(int x, int y) {
makeRoot(x);
access(y), splay(y);
}
void link(int x, int y)
void cut(int x, int y)
}
}
inline void solve(){
int n, m; cin >> n >> m;
for(int i = 1, c = 0; i <= n; i++) cin >> c, LCT::tree[i].init_color(c);
for(int i = 1; i < n; i++) {
int u, v; cin >> u >> v;
LCT::link(u, v);
}
while(m--) else if(op == 'Q') {
int u, v; cin >> u >> v;
LCT::split(u, v);
cout << LCT::tree[v].ans << endl;
}
}
}
signed main()