#include<bits/stdc++.h>
using namespace std;
const int N = 1010, inf = 0x3f3f3f3f;
int n;
int dp[N][N * 5], x[N], g[5 * N];
vector<int> G[N]; 
// dp[u]:选不同颜色最少能给这种颜色留下的体积 
void dfs(int u)
{
	memset(dp[u], inf, sizeof(dp[u]));
	dp[u][0] = 0;	
	for(int i = 0; i < G[u].size(); ++i)
	{
		int v = G[u][i];
		dfs(v);
		static int f[N * 5];
		memset(f, inf, sizeof(f));
		for(int i = N * 5 - x[v]; i >= 0; --i) f[i + x[v]] = min(f[i + x[v]], dp[u][i] + g[v]);
		for(int i = N * 5 - g[v]; i >= 0; --i) f[i + g[v]] = min(f[i + g[v]], dp[u][i] + x[v]);
		copy(f, f + N * 5, dp[u]);
	}
	g[u] = inf;
	for(int i = 0; i <= x[u]; ++i) g[u] = min(g[u], dp[u][i]);
}
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(g[1] == inf ? "IMPOSSIBLE" : "POSSIBLE");
	return 0;
}