#include <bits/stdc++.h>

const int maxn = 1010, maxm = 5010, oo = 12345678;

int n;
std::vector<int> g[maxn];
int dp[maxm], pd[maxm], x[maxn][2];

void chkmin(int &x, int y) {
	(x > y) && (x = y);
}

void dfs(int u) {
	for (int v: g[u]) {
		dfs(v);
	}
	for (int i = 1; i <= x[u][0]; ++i) {
		dp[i] = oo;
	}
	dp[0] = 0;
	for (int v: g[u]) {
		for (int i = 0; i <= x[u][0]; ++i) {
			pd[i] = oo;
			if(i >= x[v][0]) {
				chkmin(pd[i], dp[i - x[v][0]] + x[v][1]);
			}
			if(i >= x[v][1]) {
				chkmin(pd[i], dp[i - x[v][1]] + x[v][0]);
			}
		}
		memcpy(dp, pd, sizeof(dp[0]) * (x[u][0] + 1));
	}
	x[u][1] = oo;
	for (int i = 0; i <= x[u][0]; ++i) {
		chkmin(x[u][1], dp[i]);
	}
	if(x[u][1] == oo) {
		puts("IMPOSSIBLE");
		exit(0);
	}
//	printf("%d\t%d %d\n", u, x[u][0], x[u][1]);
	return;
}

int main() {
	scanf("%d", &n);
	for (int i = 2; i <= n; ++i) {
		int p;
		scanf("%d", &p);
		g[p].push_back(i);
	}
	for (int i = 1; i <= n; ++i) {
		scanf("%d", x[i]);
	}
	dfs(1);
	puts("POSSIBLE");
	return 0;
}