import sys
sys.setrecursionlimit(10**6)
n = int(input())
p = list(map(int, input().split()))
p = [-1] + [q-1 for q in p]
c = [[] for _ in range(n)]
for i in range(1, n):
	c[p[i]].append(i)
x = list(map(int, input().split()))

def dfs(cur):
	dp = [10**10 for _ in range(x[cur]+1)]
	dp[0] = 0
	for v in c[cur]:
		z, w = dfs(v)
		#print(cur, z, w)
		for i in range(x[cur], -1, -1):
			if dp[i] < 10**10:
				tmp = dp[i]
				dp[i] = 10**10
				if i+z <= x[cur]:
					dp[i+z] = min(dp[i+z], tmp+w)
				if i+w <= x[cur]:
					dp[i+w] = min(dp[i+w], tmp+z)
	#print(cur, dp)
	if min(dp) == 10**10:
		print("IMPOSSIBLE")
		sys.exit()
	return min(dp), x[cur]

dfs(0)
print("POSSIBLE")