#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=int(b); i++)
#define per(i,a,b) for (int i=(a); i>=int(b); i--)
using namespace std;

const int maxn = 1005, maxm = 5005;
int f[maxn][maxm], x[maxn], y[maxn], n, p;
vector<int> e[maxn];

void dfs(int u) {
	f[u][0] = 0;
	for (auto v : e[u]) {
		dfs(v);
		per (i, x[u], 0) {
			int A = (i >= x[v] ? f[u][i-x[v]] + y[v] : 1e9 + 99);
			int B = (i >= y[v] ? f[u][i-y[v]] + x[v] : 1e9 + 99);
			f[u][i] = min(A, B);
		}
	}
	rep (i, 0, x[u]) y[u] = min(y[u], f[u][i]);
}

int main() {
	scanf("%d", &n);
	rep (i, 2, n) {
		scanf("%d", &p);
		e[p].push_back(i);
	}
	rep (i, 1, n) scanf("%d", &x[i]);
	memset(f, 0x3f, sizeof f);
	memset(y, 0x3f, sizeof y);
	dfs(1);
	if (y[1] < 1e9) puts("POSSIBLE");
	else puts("IMPOSSIBLE");
	return 0;
}