n = int(input())
parents = list(map(int, input().split()))
weights = list(map(int, input().split()))

children = [[] for _ in range(n)]
for i in range(n-1):
    children[parents[i]-1].append(i+1)


def dfs(cur):
    if children[cur] == []:
        return (weights[cur], 0)

    sum = 0
    dp = [[False] * (weights[cur] + 1) for _ in range(len(children[cur])+1)]
    dp[0][0] = True
    for i, child in enumerate(children[cur]):
        x, y = dfs(child)
        sum += x + y
        for j in range(weights[cur] + 1):
            if j + x <= weights[cur]:
                dp[i+1][j+x] += dp[i][j]
            if j + y <= weights[cur]:
                dp[i+1][j+y] += dp[i][j]

    tmp = -1
    for i in range(weights[cur]+1):
        if dp[-1][i]:
            tmp = i
    
    if tmp == -1:
        print('IMPOSSIBLE')
        exit()

    else:
        return (weights[cur], sum-tmp)

dfs(0)
print('POSSIBLE')