#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <cstdlib>

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define pb push_back

using namespace std;

const int N = 1010, M = 5010;

int x[N], y[N], n;
vector<int> G[N];
bool f[M], dp[M];

void DFS(int o){
	int sum = 0;
	for(int v : G[o]) DFS(v), sum += x[v] + y[v];
	memset(f, false, sizeof f);
	f[0] = true;
	for(int v : G[o])
		Forr(i, x[o], 0) f[i] = (i >= x[v] && f[i - x[v]]) || (i >= y[v] && f[i - y[v]]);
	bool flag = true;
	Forr(i, x[o], 0) if(f[i]){
		sum += x[o] - i;
		flag = false;
		break;
	}
	if(flag){
		puts("IMPOSSIBLE");
		exit(0);
	}
	y[o] = sum - x[o];
}

int main(){
	scanf("%d", &n);
	For(i, 2, n){
		int p;
		scanf("%d", &p);
		G[p].pb(i);
	}
	For(i, 1, n) scanf("%d", &x[i]);
	DFS(1);
	puts("POSSIBLE");
	return 0;
}