#include<bits/stdc++.h>
#define N 5005
using namespace std;
int n,fa[N],ft[N],a[N],b[N];
vector<int>e[N];
void biu()
{
	puts("IMPOSSIBLE");
	exit(0);
}
void dfs(int x)
{
	int fl[N];
	memset(fl,0,sizeof fl);
	fl[0]=1;
	int sum=0;
	for (int i=0;i<e[x].size();i++)
	{
		dfs(e[x][i]);
		sum+=a[e[x][i]]+b[e[x][i]];
		memset(ft,0,sizeof ft);
		for (int j=0;j<=a[x];j++)
			ft[j]=(j>=a[e[x][i]]&&fl[j-a[e[x][i]]])||(j>=b[e[x][i]]&&fl[j-b[e[x][i]]]);
		memcpy(fl,ft,sizeof fl);
	}
	int now=a[x];
	for (;now>=0&&!fl[now];now--);
	if (now==-1) biu();
	sum-=now;
	b[x]=sum;
}
int main()
{
	scanf("%d",&n);
	for (int i=2;i<=n;i++)
	{
		scanf("%d",&fa[i]);
		e[fa[i]].push_back(i);
	}
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	dfs(1);
	puts("POSSIBLE");
}