#include<bits/stdc++.h>
#define maxn 100005
#define INF 0x3f3f3f3f
using namespace std;
vector<int> V[maxn];
int dp[maxn];
int minn[maxn];
int x[maxn];
void dfs(int u, int f) {
	if(u == 0) return;
	for(int i=0; i<V[u].size(); i++) {
		int v = V[u][i];
		if(v == u) continue;
		if(v == 0) continue;
		dfs(v, u);
	}
	memset(dp,INF,sizeof(dp));
	dp[0] = 0;
	for(int i=0; i<V[u].size(); i++) {
		int v = V[u][i];
		for(int j=x[u];j>=0;j--) {
			int tmp = INF;
			if(j>=x[v]) tmp = min(tmp, dp[j-x[v]]+minn[v]);
			if(j>=minn[v]) tmp = min(tmp, dp[j-minn[v]]+x[v]);
			dp[j] = tmp;
		}
	}
	for(int i=0; i<=x[u]; i++)
		minn[u] = min(minn[u], dp[i]);
}
signed main() {
	int n;
	cin >> n;
	for(int i=2; i<=n; i++) {
		int fa;
		scanf("%d",&fa);
		V[fa].push_back(i);
	}
	memset(minn,INF,sizeof(minn));
	for(int i=1; i<=n; i++) scanf("%d",&x[i]);
	dfs(1, 0);
	if(minn[1]<INF) printf("POSSIBLE\n");
	else printf("IMPOSSIBLE\n");
}