#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
int n, p[1009], x[1009], dp[1009]; bool f = true; vector<int> g[1009];
void dfs(int pos) {
	vector<vector<int> > dp2(g[pos].size() + 1, vector<int>(x[pos] + 1, inf));
	fill(dp2[0].begin(), dp2[0].end(), 0);
	for (int i = 0; i < g[pos].size(); i++) {
		int p = g[pos][i];
		dfs(p);
		for (int j = x[pos]; j >= x[p]; j--) dp2[i + 1][j] = min(dp2[i + 1][j], dp2[i][j - x[p]] + dp[p]);
		for (int j = x[pos]; j >= dp[p]; j--) dp2[i + 1][j] = min(dp2[i + 1][j], dp2[i][j - dp[p]] + x[p]);
	}
	int ret = *min_element(dp2[g[pos].size()].begin(), dp2[g[pos].size()].end());
	if (ret == inf) f = false;
	dp[pos] = ret;
}
int main() {
	cin >> n;
	for (int i = 1; i < n; i++) {
		cin >> p[i], p[i]--;
		g[p[i]].push_back(i);
	}
	for (int i = 0; i < n; i++) cin >> x[i];
	dfs(0);
	cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}