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

const int N=5010,inf=1e9;
int fa[N],a[N],b[N],f[N],n;
vector<int>g[N];

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=2;i<=n;++i)cin>>fa[i],g[fa[i]].push_back(i);
	for(int i=1;i<=n;++i)cin>>a[i];
	for(int i=n;i;--i){
		memset(f,0,sizeof f);
		for(int j:g[i]){
			for(int k=a[i];k>=0;--k){
				int tmp=inf;
				if(k>=a[j])tmp=min(tmp,f[k-a[j]]+b[j]);
				if(k>=b[j])tmp=min(tmp,f[k-b[j]]+a[j]);
				f[k]=tmp;
			}
		}
		if(f[a[i]]>=inf){
			cout<<"IMPOSSIBLE\n";
			return 0;
		}
		b[i]=f[a[i]];
	}
	cout<<"POSSIBLE\n";
	return 0;
}
