#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Fileio freopen("output.txt","w",stdout);freopen("input.txt","r",stdin);
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define MEM(a,x) memset(a,x,sizeof(a))
#define SZ(v) v.size()
#define nl "\n"
#define bug cout<<"bug"<<nl;
#define pi acos(-1.0)
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair< int,int >
#define pll pair< ll,ll >
#define vii vector< int >
#define vll vector< ll >
#define vpi vector< pii >
#define vpl vector<pll>
#define MX 100005
#define EPS 1e-12
#define ss second
#define ff first
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<typename T>
using ordered_multiset=tree<T, null_type, less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>;
inline ll powr(int a,int b){ll res=1;while(b){if(b&1) res*=a;a*=a;b/=2;}return res;}
int cases=1;
#ifdef ppqq
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1){
cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names+1, ',');
cerr.write(names, comma - names) << " is " << arg1 <<" ";
__f(comma+1, args...);
}
#else
#define debug(...)
#endif
///******************************************START******************************************
string col;
int white[4006],black[4005];
vii adj[4005];
void dfs(int u,int p)
{
//debug(u);
for(auto it: adj[u])
{
if(it==p) continue;
dfs(it,u);
black[u]+=black[it];
white[u]+=white[it];
}
if(col[u-1]=='W') white[u]++;
else black[u]++;
//debug(u,white[u],black[u]);
}
int main()
{
FIO;
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
for(int i=2;i<=n;i++)
{
int x;
cin>>x;
adj[i].pb(x);
adj[x].pb(i);
}
cin>>col;
dfs(1,-1);
int cnt=0;
for(int i=1;i<=n;i++)
{
if(white[i]==black[i]) cnt++;
}
cout<<cnt<<nl;
for(int i=0;i<n+3;i++)
{
adj[i].clear();
white[i]=0;
black[i]=0;
}
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2luY2x1ZGU8ZXh0L3BiX2RzL2Fzc29jX2NvbnRhaW5lci5ocHA+CiNpbmNsdWRlPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+CiNkZWZpbmUgIEZJTyAgICAgICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsgY2luLnRpZSgwKTsgY291dC50aWUoMCk7CiNkZWZpbmUgIEZpbGVpbyAgICAgZnJlb3Blbigib3V0cHV0LnR4dCIsInciLHN0ZG91dCk7ZnJlb3BlbigiaW5wdXQudHh0IiwiciIsc3RkaW4pOwojZGVmaW5lICBhbGwodikgICAgIHYuYmVnaW4oKSx2LmVuZCgpCiNkZWZpbmUgIHJhbGwodikgICAgdi5yYmVnaW4oKSx2LnJlbmQoKQojZGVmaW5lICBNRU0oYSx4KSAgIG1lbXNldChhLHgsc2l6ZW9mKGEpKQojZGVmaW5lICBTWih2KSAgICAgIHYuc2l6ZSgpCiNkZWZpbmUgIG5sICAgICAgICAgIlxuIgojZGVmaW5lICBidWcgICAgICAgIGNvdXQ8PCJidWciPDxubDsKI2RlZmluZSAgcGkgICAgICAgICBhY29zKC0xLjApCiNkZWZpbmUgIGxsICAgICBsb25nIGxvbmcKI2RlZmluZSAgcGIgICAgIHB1c2hfYmFjawojZGVmaW5lICBtcCAgICAgbWFrZV9wYWlyCiNkZWZpbmUgIHBpaSAgICBwYWlyPCBpbnQsaW50ID4KI2RlZmluZSAgcGxsICAgIHBhaXI8IGxsLGxsID4KI2RlZmluZSAgdmlpICAgIHZlY3RvcjwgaW50ID4KI2RlZmluZSAgdmxsICAgIHZlY3RvcjwgbGwgPgojZGVmaW5lICB2cGkgICAgdmV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mdzJiYuLi4gYXJncyl7CiAgICAgICAgY29uc3QgY2hhciogY29tbWEgPSBzdHJjaHIobmFtZXMrMSwgJywnKTsKICAgICAgICBjZXJyLndyaXRlKG5hbWVzLCBjb21tYSAtIG5hbWVzKSA8PCAiIGlzICIgPDwgYXJnMSA8PCIgICI7CiAgICAgICAgX19mKGNvbW1hKzEsIGFyZ3MuLi4pOwogICAgfQojZWxzZQogICAgI2RlZmluZSBkZWJ1ZyguLi4pCiNlbmRpZgoKLy8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqU1RBUlQqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKc3RyaW5nIGNvbDsKaW50IHdoaXRlWzQwMDZdLGJsYWNrWzQwMDVdOwp2aWkgYWRqWzQwMDVdOwp2b2lkIGRmcyhpbnQgdSxpbnQgcCkKewogICAgLy9kZWJ1Zyh1KTsKICAgIGZvcihhdXRvIGl0OiBhZGpbdV0pCiAgICB7CiAgICAgICAgaWYoaXQ9PXApIGNvbnRpbnVlOwogICAgICAgIGRmcyhpdCx1KTsKICAgICAgICBibGFja1t1XSs9YmxhY2tbaXRdOwogICAgICAgIHdoaXRlW3VdKz13aGl0ZVtpdF07CiAgICB9CiAgICBpZihjb2xbdS0xXT09J1cnKSB3aGl0ZVt1XSsrOwogICAgZWxzZSBibGFja1t1XSsrOwogICAgLy9kZWJ1Zyh1LHdoaXRlW3VdLGJsYWNrW3VdKTsKfQppbnQgbWFpbigpCnsKICAgIEZJTzsKICAgIGludCB0OwogICAgY2luPj50OwogICAgd2hpbGUodC0tKQogICAgewogICAgICAgIGludCBuOwogICAgICAgIGNpbj4+bjsKICAgICAgICBmb3IoaW50IGk9MjtpPD1uO2krKykKICAgICAgICB7CiAgICAgICAgICAgIGludCB4OwogICAgICAgICAgICBjaW4+Png7CiAgICAgICAgICAgIGFkaltpXS5wYih4KTsKICAgICAgICAgICAgYWRqW3hdLnBiKGkpOwogICAgICAgIH0KCiAgICAgICAgY2luPj5jb2w7CgogICAgICAgIGRmcygxLC0xKTsKICAgICAgICBpbnQgY250PTA7CgogICAgICAgIGZvcihpbnQgaT0xO2k8PW47aSsrKQogICAgICAgIHsKICAgICAgICAgICAgaWYod2hpdGVbaV09PWJsYWNrW2ldKSBjbnQrKzsKICAgICAgICB9CgogICAgICAgIGNvdXQ8PGNudDw8bmw7CgogICAgICAgIGZvcihpbnQgaT0wO2k8biszO2krKykKICAgICAgICB7CiAgICAgICAgICAgIGFkaltpXS5jbGVhcigpOwogICAgICAgICAgICB3aGl0ZVtpXT0wOwogICAgICAgICAgICBibGFja1tpXT0wOwogICAgICAgIH0KICAgIH0KCgoKCgoKCgoKCgoKfQo=