#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> children;
vector<int> X;
int f(int v) {
	if (children[v].empty()) return 0;
	vector<pair<int,int>> a;
	int N = X[v];
	vector<int> dp(N+1, 1<<30);
	dp[0] = 0;
	for (int x : children[v]) {
		int a = X[x];
		int b = f(x);
		if (b < 0) return -1;
		vector<int> dp2(N+1, 1<<30);
		for (int i = 0; i+a <= N; ++ i) dp2[i+a] = min(dp2[i+a], dp[i]+b);
		for (int i = 0; i+b <= N; ++ i) dp2[i+b] = min(dp2[i+b], dp[i]+a);
		dp.swap(dp2);
	}
	auto r = *min_element(dp.begin(), dp.end());
	if (r == 1<<30) return -1;
	return r;
}
int main() {
	int N;
	cin >> N;
	children.resize(N+1);
	X.resize(N+1);
	for (int i = 2; i <= N; ++ i) {
		int x;
		cin >> x;
		children[x].push_back(i);
	}
	for (int i = 1; i <= N; ++ i) cin >> X[i];
	int r = f(1);
	if (r < 0) {
		cout << "IMPOSSIBLE" << endl;
	} else {
		cout << "POSSIBLE" << endl;
	}
}
