#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const int INF=0x3f3f3f3f;
int n,a[1001],f[1001],g[1001][5001],head[1001],now[5001],tot=0;
struct data {
	int next,num;
}edge[2001];
void add(int u,int v) {
	edge[++tot].next=head[u];
	edge[tot].num=v;
	head[u]=tot;
}
void dfs(int x) {
	memset(g[x],0x3f,sizeof(g[x]));
	g[x][0]=0;
	for (int i=head[x];i!=-1;i=edge[i].next) {
		int kx=edge[i].num;
		dfs(kx);
		memset(now,0x3f,sizeof(now));
		for (int j=a[kx];j<=a[x];j++) now[j]=min(now[j],g[x][j-a[kx]]+f[kx]);
		for (int j=f[kx];j<=a[x];j++) now[j]=min(now[j],g[x][j-f[kx]]+a[kx]);
		for (int j=0;j<=a[x];j++) g[x][j]=now[j];
	}
	f[x]=INF;
	for (int i=0;i<=a[x];i++) f[x]=min(f[x],g[x][i]);
}
int main() {
	memset(head,-1,sizeof(head));
	scanf("%d",&n);
	for (int i=2;i<=n;i++) {
		int fat;
		scanf("%d",&fat);
		add(fat,i);
	}
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	dfs(1);
	if (f[1]==INF) printf("IMPOSSIBLE\n");
		else printf("POSSIBLE\n");
	return 0;
}