#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>
#include <bitset>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n;
	std::cin >> n;
	std::vector<std::vector<int>> edges(n);
	for(int i = 1; i < n; i++) {
		int p;
		std::cin >> p;
		edges[p-1].push_back(i);
	}
	std::vector<int> a(n);
	for(int i = 0; i < n; i++) {
		std::cin >> a[i];
	}
	std::vector<int> dp(n);
	const int ms = 5050;
	for(int i = n-1; i >= 0; i--) {
		std::bitset<ms> cur;
		cur[0] = 1;
		int bst = 0;
		int other = 0;
		for(auto j : edges[i]) {
			int u = a[j], v = dp[j];
			if(u > v) std::swap(u, v);
			bst += u;
			other += v - u;
			cur |= (cur << (v-u));
		}
		if(bst > a[i]) {
			std::cout << "IMPOSSIBLE\n";
			return 0;
		}
		int id = a[i] - bst;
		while(!cur[id]) id--;
		dp[i] = other - id;
	}
	std::cout << "POSSIBLE\n";
}