#include<bits/stdc++.h>
using namespace std;
const int N=1005,M=5005;
int sum[N],n,fa[N],a[N],b[N],dp[N][M];
int main(){
	scanf("%d",&n);
	for (int i=2;i<=n;i++)scanf("%d",&fa[i]);
	for (int i=1;i<=n;i++)scanf("%d",&a[i]);
	for (int i=1;i<=n;i++)dp[i][0]=1;
	for (int i=n;i;i--){
		b[i]=-1;
		for (int j=a[i];j>=0;j--)
			if (dp[i][j]){
				b[i]=sum[i]-j;
				break;
			}
		if (b[i]==-1){
			puts("IMPOSSIBLE");
			return 0;
		}
		if (i==1)continue;
		int y=fa[i];
		for (int j=a[y];j>=0;j--){
			if (a[i]&&b[i])dp[y][j]=0;
			if (j>=a[i])dp[y][j]|=dp[y][j-a[i]];
			if (j>=b[i])dp[y][j]|=dp[y][j-b[i]];
		}
		sum[y]+=a[i]+b[i];
	}
	puts("POSSIBLE");
}
