#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)n; ++i)

int n, tw[1001], mn[1001], inf = 1e9;
vector<int> tr[1001];

inline void up(vector<int> &d1, vector<int> &d2, int i, int j, int c){
	j += i;
	if (j > 5000)return;
	d2[j] = min(d2[j], d1[i] + c);
}

void go(int v = 1){
	vector<vector<int> > dp(tr[v].size() + 1, vector<int>(5001, 1e9));
	dp[0][0] = 0;
	f(ed, 0, tr[v].size()){
		int u = tr[v][ed];
		go(u);
		for (int i = 5000; i >= 0; --i){
			up(dp[ed], dp[ed + 1], i, tw[u], mn[u]);
			up(dp[ed], dp[ed + 1], i, mn[u], tw[u]);
		}
	}
	mn[v] = inf;
	f(i, 0, tw[v] + 1)mn[v] = min(mn[v], dp[tr[v].size()][i]);
	if (mn[v] == inf)printf("IMPOSSIBLE\n"), exit(0);
}

int main(){
	scanf("%d", &n);
	f(i, 2, n + 1){
		int t;
		scanf("%d", &t);
		tr[t].push_back(i);
	}
	f(i, 1, n + 1)scanf("%d", tw + i);
	go();
	printf("POSSIBLE\n");
}