import sys
N = int(input())
M = 5000
I = [[] for _ in range(N)]

i = 1
for a in list(map(int, input().split())):
  I[a-1].append(i)
  i += 1
X = list(map(int, input().split()))

def dfs(v,I,X):
  INF = 10**20
  DP = [INF for _ in range(X[v]+1)]
  DP[0] = 0
  for i in I[v]:
    x = X[i]
    y = dfs(i,I,X)
    if x < y:
      x,y = y,x  # x >= y
    for a in range(X[v],y-1,-1):
      DP[a] = DP[a-y] + x
      if a-x >= 0:
        DP[a] = min(DP[a], DP[a-x] + y)
    for a in range(y-1, -1, -1):
      DP[a] = INF
  ans = min(DP)
  #print(DP, v)
  if ans >= INF:
    print("IMPOSSIBLE")
    sys.exit()
  return ans

dfs(0,I,X)
print("POSSIBLE")
  
  