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

vector<int>G[1010];
int g[5050],h[5050],f[1010],x,n,a[1010];

void U(int &x,int y){
	x=min(x,y);
}

void dfs(int x){
	for (auto y:G[x]) dfs(y);
	memset(g,33,sizeof g); g[0]=0;
	int b,c;
	for (auto y:G[x]){
		memset(h,33,sizeof h);
		b=f[y], c=a[y];
		for (int i=0;i<=5001;++i)
			U(h[min(i+b,5001)],g[i]+c),
			U(h[min(i+c,5001)],g[i]+b);
		memcpy(g,h,sizeof g);
	}
	for (int i=0;i<=5001;++i){
		if (i<=a[x]) U(f[x],g[i]);
		if (g[i]<=a[x]) U(f[x],i);
	}
	if (f[x]>1e8) exit(0*puts("IMPOSSIBLE"));
}

int main(){
	cin>>n;
	for (int i=2;i<=n;++i) cin>>x, G[x].push_back(i);
	for (int i=1;i<=n;++i) cin>>a[i];
	memset(f,33,sizeof f);
	dfs(1);
	puts("POSSIBLE");
}