N=int(input())
G=[[] for i in range(N)]
for i,a in enumerate(input().split()):
  G[int(a)-1].append(i+1)

X=[int(i) for i in input().split()]
def dfs(x):
  s=len(G[x])
  if s==0:
    return (0,X[x])
  dp=[[False]*(X[x]+1) for i in range(s+1)]
  dp[0][0]=True
  S=0
  for i in range(s):
    p,q=dfs(G[x][i])
    S+=p+q
    for j in range(X[x]+1):
      if dp[i][j]:
        if j+p<=X[x]:
          dp[i+1][j+p]=True
        if j+q<=X[x]:
          dp[i+1][j+q]=True
  a=-1
  for j in range(X[x]+1)[::-1]:
    if dp[s][j]:
      a=j
      break
  if a<0:
    print("IMPOSSIBLE")
    exit()
  return (X[x],S-a)
dfs(0)
print("POSSIBLE")