#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector <int> vi;
#define f first
#define s second
#define FOR(i,s,e) for (ll i = s; i <= (ll)e; i++)
#define DEC(i,s,e) for (ll i = s; i >= e; i--)
#define aFOR(i,s) for (auto i: s)
#define maxn 1000
#define maxx 500
#define INF 1e9
#define pb push_back
#define int ll
int N;
int p[maxn];
int A[maxn];

vi adj[maxn];

int dp[maxn];

int dp2[maxn][maxx];
int B[maxn];

bool np = 0;
void dfs(int x){
	if (vis[x] || np){
		np = 1;
		return;
	}
	vis[x] = 1;
	

	dp[x] = INF;
	aFOR(i,adj[x]){
		dfs(i);
	}
	int sm = 0;
	FOR(i,0,adj[x].size()-1){
		B[i] = abs(A[adj[x][i]] - dp[adj[x][i]]);
		sm += min(A[adj[x][i]],dp[adj[x][i]]);
	}
	if (A[x] < sm){
		dp[x] = INF;
		return;
	}
	FOR(i,0,adj[x].size() - 1){
		FOR(j,0,A[x] - sm){
			dp2[i][j] = INF;
			if (i == 0){
				dp2[i][j] = B[i];
				if (j >= B[i]) dp2[i][j]  = 0;
			}else{
				if (j >= B[i]) dp2[i][j] = min(dp2[i-1][j] + B[i],dp2[i-1][j-B[i]]);
				else dp2[i][j] = dp2[i-1][j] + B[i];
			}
		}
	}
	
	if (adj[x].empty()) dp[x] = 0;
	else dp[x] = dp2[adj[x].size()-1][A[x]-sm] + sm;
}

int32_t main(){
	cin>>N;
	
	FOR(i,2,N){
		cin>>p[i];
		adj[p[i]].pb(i);
	}

	FOR(i,1,N) cin>>A[i];

	dfs(1);
	
	
	if (dp[1] == INF || np) cout<<"IMPOSSIBLE";
	else cout<<"POSSIBLE";
}
