#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	std::vector<int> x(n);
	std::vector<std::vector<int>> g(n);
	for(int i = 1; i < n; i++) {
		int p; scanf("%d", &p);
		
		g[p - 1].push_back(i);
	}
	for(int i = 0; i < n; i++) scanf("%d", &x[i]);
	
	std::function<void (int&, int)> chmin = [](int& v, int x) {
		if(v == -1) {
			v = x;
			return;
		}
		if(x == -1) return;
		v = std::min(v, x);
	};
	
	bool ans = true;
	const int INF = -1;
	auto dp = make_v<int>(n, 2);
	std::function<void (int)> solve = [&](int v) {
		for(auto e: g[v]) solve(e);
		
	//	cout << "----------------==" << v + 1 << "==-----------------" << endl;
		if(g[v].size() == 0) {
			dp[v][0] = dp[v][1] = 0;
			return;
		}
		
		for(int color = 0; color < 2; color++) {
			auto dp2 = make_v<int>(g[v].size() + 1, x[v] + 1);
			for(int i = 0; i < dp2.size(); i++) {
				for(int j = 0; j < dp2[i].size(); j++) dp2[i][j] = INF;
			}
			dp2[0][0] = 0;
			
			for(int i = 0; i < g[v].size(); i++) {
				int e = g[v][i];
				for(int j = 0; j < dp2[i].size(); j++) {
					if(dp2[i][j] == INF) continue;

					{
						if(j + x[e] <= x[v]) {
							chmin(dp2[i + 1][j + x[e]], dp2[i][j] + dp[e][color]);
						}
					} {
						if(j + dp[e][1 - color] <= x[v]) {
							chmin(dp2[i + 1][j + dp[e][1 - color]], dp2[i][j] + x[e]);
						}
					}
				}
			//	for(auto v: dp2[i + 1]) cout << v << " "; cout << endl;
			}
		
			int ret = 1 << 30;
			for(int i = 0; i <= x[v]; i++) chmin(ret, dp2[g[v].size()][i]);
			if(ret == (1 << 30)) ans = false;
			dp[v][color] = ret;
		//	cout << ret << endl;
		}
	};
	solve(0);
	
//	cout << "dp-------------------------OOOOO" << endl;
//	for(int i = 0; i < n; i++) cout << i + 1 << ": " << dp[i][0] << " " << dp[i][1] << endl;
	
	if(ans) printf("POSSIBLE\n");
	else printf("IMPOSSIBLE\n");
	return 0;
}
