#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
using P = pair<int, int>;
int n, a, x[1005];
vector<int> ch[1005];
P dfs(int p){
	bool ok[5005] = {true};
	int mi = 0, sm = 0, f, s, t = 0;
	for(auto it: ch[p]){
		tie(f, s) = dfs(it);
		mi += f; sm += f*2 + s;
		for(int i = x[p]; i >= s; i--) if(ok[i-s]) ok[i] = true;
	}
	if(mi > x[p]){
		puts("IMPOSSIBLE");
		exit(0);
	}
	for(int i = 0; i+mi <= x[p]; i++) if(ok[i]) t = i;
	f = sm - mi - t; s = x[p];
	if(f > s) swap(f, s);
	return P(f, s-f);
}
int main(){
	scanf("%d", &n);
	rep(i,n-1){
		scanf("%d", &a); a--;
		ch[a].push_back(i+1);
	}
	rep(i,n) scanf("%d", x+i);
	dfs(0);
	puts("POSSIBLE");
}