#include<bits/stdc++.h>
using namespace std;

#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
const int N=1000+5,U=5000+5;
int fa[N],x1[N],x2[N];
vector<int>lk[N];
int dp[U];

int main()
{
	//freopen("1.in","r",stdin);
	int n;
	cin>>n;
	rep(i,2,n){cin>>fa[i];lk[fa[i]].push_back(i);}
	rep(i,1,n)cin>>x1[i];
	per(x,n,1)
	{
		int u=x1[x];
		rep(i,0,u)dp[i]=0;
		int sum=0;
		for(auto y:lk[x])sum+=min(x1[y],x2[y]);
		if(sum>u)
		{
			puts("IMPOSSIBLE");
			exit(0);
		}
		for(auto y:lk[x])
		{
			int a=x1[y],b=x2[y];
			if(a<b)swap(a,b);
			per(i,u,a)dp[i]=min(dp[i-a]+b,dp[i-b]+a);
			per(i,a-1,b)dp[i]=dp[i-b]+a;
			per(i,b-1,0)dp[i]=U;
		}
		x2[x]=min(U,dp[u]);
	}
	puts("POSSIBLE");
}