#include<bits/stdc++.h>
using namespace std;
const int N=1e3+7,M=5e3+7; bool qc,fl[N][M],qt[N][M];
int n,w[N],s[N],fa[N],len[N]; vector<int>v[N];
inline void find(int u){
	
	fl[u][0]=1; int sum=0,h=-1;
	for(int i=0;i<len[u];i++){
		find(v[u][i]),memset(qt[u],0,sizeof(qt[u])); sum=sum+w[v[u][i]]+s[v[u][i]];
		for(int x=w[v[u][i]];x<=5e3;x++) qt[u][x]|=fl[u][x-w[v[u][i]]];
		for(int x=s[v[u][i]];x<=5e3;x++) qt[u][x]|=fl[u][x-s[v[u][i]]];
		for(int x=0;x<=5e3;x++) fl[u][x]=qt[u][x];
	}
	for(int i=w[u];i>=0;i--) if(fl[u][i]){h=i; break;}
	if(h==-1) qc=1; s[u]=sum-h;
}
int main(){
	scanf("%d",&n);
	for(int i=2;i<=n;i++) scanf("%d",&fa[i]),v[fa[i]].push_back(i),len[fa[i]]++;
	for(int i=1;i<=n;i++) scanf("%d",&w[i]); find(1);
	if(!qc) puts("POSSIBLE"); else puts("IMPOSSIBLE");
	return 0;
}