n = int(input())
p = list(map(int,input().split()))
x = list(map(int,input().split()))
g = [[] for i in range(n)]
for i in range(n-1):
  g[p[i]-1].append(i+1)
kyo = [float("inf")] * n
def dfs(x,y):
  kyo[x] = y
  for i in g[x]:
    dfs(i,y+1)
dfs(0,0)
hukai = []
for i in range(n):
  hukai.append([kyo[i],i])
hukai.sort(key = lambda x:-x[0])
INF = float("inf")
dp = [[INF]*(max(x)+3) for i in range(n)]
for i in range(n):
  dp[i][0] = 0
for j,i in hukai:
  if len(g[i]) == 0:
    dp[i][0] = 1
    continue
  tmp = []
  for k in g[i]:
    for l in range(5001):
      if dp[k]:
        tmp.append([x[k],dp[k][l]])
        break
  for l in range(x[i]+1):
    for k in tmp:
      if dp[i][l] != INF:
        if l + k[1] <=x[i]:
          dp[i][l+k[1]] = dp[i][l]+k[0]
        if l + k[0] <=x[i]:
          dp[i][l+k[0]] = dp[i][l]+k[1]
  for k in range(x[i]+1):
    if dp[i][k] != INF:
      break
    else:
      dp[i][k] = 0
  else:
    print("IMPOSSIBLE")
    exit()
print("POSSIBLE")