#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int n;
vector<int> c[1010];

int x[1010];
int d[1010];
const int inf = 1e9;

bitset<5010> dp, tmp, msk;

void dfs(int v){
	for(int i:c[v]){
		dfs(i);
	}
	dp.reset(); msk.reset();
	dp.set(0);
	for(int i=0; i<=x[v]; ++i) msk.set(i);
	
	int as = 0, ms = 0;
	for(int i:c[v]){
		int D=d[i], X=x[i];
		
		tmp = (dp<<D) | (dp<<X);
		dp = tmp & msk;
		
		as += D+X;
		ms += min(D, X);
	}
	if(x[v] < ms){
		puts("IMPOSSIBLE");
		exit(0);
	}
	for(int i=x[v]; ms<=i; --i) if(dp[i]){
		d[v] = as - i;
		break;
	}
}

int main()
{
	read(n);
	for(int x, i=2; i<=n; ++i){ read(x); c[x].pb(i); }
	for(int i=1; i<=n; ++i) read(x[i]);
	dfs(1);
	puts("POSSIBLE");
	return 0;
}
