#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;
typedef pair<int, int> P;

int N;
int X[1005];
vector<int> next[1005];

P dfs(int i)
{
	if((int)next[i].size() == 0) return make_pair(0, X[i]);
	
	vector<P> vec;
	for(int j = 0; j < (int)next[i].size(); j++){
		vec.push_back(dfs(next[i][j]));
		if(vec.back().first == -1) return make_pair(-1, -1);
	}
	
	vector<int> dif;
	int min = 0, max = 0;
	for(int j = 0; j < (int)vec.size(); j++){
		min += vec[j].first;
		max += vec[j].second;
		dif.push_back(max - min);
	}
	if(X[i] < min) return make_pair(-1, -1);
	if(X[i] >= max) return make_pair(min, X[i]);
	
	sort(dif.begin(), dif.end());
	
	bool dp[5005];
	for(int j = 0; j <= max; j++) dp[j] = false;
	
	dp[0] = true;
	for(int k = 0; k < (int)dif.size(); k++){
		if(dif[k] > max) break;
		for(int j = max; j >= 0; j--){
			if(dp[j - dif[k]]) dp[j] = true;
		}
	}
	
	
	for(int j = max - X[i]; j <= max; j++){
		if(dp[j]){
			P ret = make_pair(min + j, X[i]);
			if(min + j > X[i]) ret = make_pair(X[i], min + j);
			return ret;
		}
	}
}

int main(void)
{
	cin >> N;
	
	int p;
	for(int i = 2; i <= N; i++){
		cin >> p;
		next[p].push_back(i);
	}
	for(int i = 1; i <= N; i++) cin >> X[i];
	
	P ans = dfs(1);
	if(ans.first == -1) cout << "IMPOSSIBLE" << endl;
	else cout << "POSSIBLE" << endl;
	
	return 0;
}