import sys
from collections import defaultdict

# 后序遍历(所谓树形DP)
n = int(input())
sons = defaultdict(list)
ps = list(map(int, input().split()))
for i in range(len(ps)):
    sons[ps[i]].append(i+2)

color = ' ' + input()
dp = [0] * (n+1)

def postorder(id):
    for s in sons[id]:
        postorder(s)
    if color[id] == 'R':
        dp[id] += 1
    for s in sons[id]:
        dp[id] += dp[s]

postorder(1)
q = int(input())
for i in range(q):
    print(dp[int(input())])