
from itertools import chain,product

N = int(input())

P = list(chain((0,), map(lambda x: int(x)-1,input().split())))
X = list(map(int,input().split()))

L = [list() for _ in range(N)]

# 葉ノード探索
D = [0]*N
for p in P:
  D[p] += 1
D[0] -= 1
stack = [i for i,t in enumerate(D) if t==0]


while stack:
  i = stack.pop()
  p = P[i]
  l = L[i]

  x = X[i]

  # len(l) < 10のとき全探索、それ以上はDP
  if len(l) < 10:
    m = -1
    for s in product(*l):
      n = sum(s)
      if n <= x:
        m = max(n,m)
    if m == -1:
      print('IMPOSSIBLE')
      exit()
    m = sum(chain.from_iterable(l)) - m
  else:
    offset = sum(min(t) for t in l)
    x -= offset
    if x < 0:
      print('IMPOSSIBLE')
      exit()
    dp = [False]*(x+1)
    dp[0] = True
    s = 0
    for a,b in l:
      d = abs(a-b)
      s += d
      for i in range(x-d+1):
        dp[i+d] = dp[i+d] or dp[i]

    m = x
    while not dp[m]:
      m -= 1
    m = s-m
    m += offset


  L[p].append((x,m))
  D[p] -= 1
  if D[p] == 0:
    stack.append(p)

print('POSSIBLE')

