#include <bits/stdc++.h>
using namespace std;
const int MAX = (5e3)+1, INF = 1e9;

int n, x[MAX], dp[MAX], f[2][MAX];
vector<int> g[MAX];

void dfs(int u) {
	for(int v: g[u]) dfs(v);
	fill(f[0], f[0]+MAX, INF);
	fill(f[1], f[1]+MAX, INF);
	f[0][0] = 0;
	int pre = 0, curr = 1;
	for(int v: g[u]) {
		for(int i = MAX - 1 - min(dp[v], x[v]); i >= 0; i--) {
			if(i + dp[v] < MAX) f[curr][i + dp[v]] = min(f[pre][i] + x[v], f[curr][i + dp[v]]);
			if(i + x[v] < MAX) f[curr][i + x[v]] = min(f[pre][i] + dp[v], f[curr][i + x[v]]);
		}
		fill(f[pre], f[pre]+MAX, INF);
		swap(pre, curr);
	}
	if(u == 1 || g[u].size()) for(int i = 0; i <= x[u]; i++) dp[u] = min(f[pre][i], dp[u]);
	else dp[u] = 0;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for(int i = 2, p; i <= n; i++) {
		cin >> p;
		g[p].push_back(i);
	}
	for(int i = 1; i <= n; i++) cin >> x[i];
	fill(dp+1, dp+n+1, INF);
	dfs(1);

	bool valid = true;
	for(int i = 1; i <= n; i++) valid &= dp[i] < INF;
	if(valid) cout << "POSSIBLE";
	else cout << "IMPOSSIBLE";
}
