#include<bits/stdc++.h>
using namespace std;
const int N=1e3+10;

int n,a[N],f[N];
vector<int> E[N];

void dfs(int u) {
	for(auto v:E[u]) dfs(v);
	vector<bool> dp(a[u]+1);
	dp[0]=1;
	int sum=0;
	for(auto v:E[u]) {
		vector<bool> new_dp(a[u]+1);
		for(int i=a[u];~i;i--) {
			if(i>=a[v]) new_dp[i]=new_dp[i]|dp[i-a[v]];
			if(i>=f[v]) new_dp[i]=new_dp[i]|dp[i-f[v]];
		}
		swap(dp,new_dp);
		sum+=a[v]+f[v];
	}
	bool fl=0;
	for(int i=a[u];~i;i--)
		if(dp[i]) {
			f[u]=sum-i;fl=1;break;
		}
	if(!fl) cout<<"IMPOSSIBLE",exit(0);
}

int main() {
	cin>>n;
	for(int i=2,fa;i<=n;i++) cin>>fa,E[fa].push_back(i);
	for(int i=1;i<=n;i++) cin>>a[i];
	dfs(1);
	cout<<"POSSIBLE";
	return 0;
}
