#include <iostream>
#include <vector>
#include <bitset>
#define N 1005
using namespace std;
int n, s, x[N], y[N];
vector<int> a[N];
bitset<1<<20> bs;

int main() {
	int i, j, t;
	cin>>n;
	for(i=2; i<=n; i++) cin>>t, a[t].push_back(i);
	for(i=1; i<=n; i++) cin>>x[i];
	for(i=n; i>=1; i--) {
		bs = 1;
		s = 0;
		for(j=0; j<a[i].size(); j++) {
			t = a[i][j];
			bs = bs<<x[t] | bs<<y[t];
			s += x[t] + y[t];
		}
		for(j=x[i]; j>=0 && !bs[j]; j--);
		if(j<0) {cout<<"IMPOSSIBLE"; return 0;}
		else y[i] = s - j;
	}
	cout<<"POSSIBLE";
	return 0;
}