#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
using namespace std;
 
int x[1000];
vector<int>E[1000];
int memo[2000];
unordered_map<int,int>dp[2000];
 
void dfs(int v){
	if(E[v].empty()){
		memo[v]=0;
		return;
	}
	for(auto u:E[v]){
		dfs(u);
	}
	dp[0][0]=0;
	rep(i,E[v].size()){
		dp[i+1].clear();
		for(auto&p:dp[i]){
			int j=p.first,k=x[E[v][i]],t=memo[E[v][i]];
			if(j+x[E[v][i]]<=x[v]){
				if(dp[i+1].count(j+k)==0)dp[i+1][j+k]=dp[i][j]+t;
				else dp[i+1][j+k]=min(dp[i+1][j+k],dp[i][j]+t);
			}
			if(j+t<=x[v]){
				if(dp[i+1].count(j+t)==0)dp[i+1][j+t]=dp[i][j]+k;
				else dp[i+1][j+t]=min(dp[i+1][j+t],dp[i][j]+k);
			}
		}
	}
	memo[v]=INF;
	rep(i,x[v]+1){
		if(dp[E[v].size()].count(i)==0)continue;
		memo[v]=min(memo[v],dp[E[v].size()][i]);
	}
	if(memo[v]==INF){
		puts("IMPOSSIBLE");exit(0);
	}
}
int main(){
	int n;scanf("%d",&n);
	rep(i,n-1){
		int p;scanf("%d",&p);p--;
		E[p].push_back(i+1);
	}
	rep(i,n)scanf("%d",&x[i]);
	dfs(0);
	puts("POSSIBLE");
}