#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define ALL(obj) (obj).begin(),(obj).end()

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template<class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl;exit(0);}else return;}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b) { a = max<T>(a, b); }
template <class T> void chmin(T& a, const T b) { a = min<T>(a, b); }
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	int N; cin >> N;
	V<int> parent(N, 0),X(N, 0), depth(N,-1);
	V<V<int>> child(N);

	if (N == 1){
		int X; cin >> X;
		cout << "POSSIBLE" << endl;
		return 0;
	}

	for(int i = 1; i < N; ++i){
		int p; cin >> p; p--;
		parent[i] = p;
		child[p].push_back(i);
	}

	for (int i = 0; i < N; ++i) cin >> X[i];

	queue<int> q;
	q.push(0);
	depth[0] = 0;

	while(q.size()){
		int from = q.front();
		q.pop();
		for(auto to: child[from]){
			depth[to] = depth[from] + 1;
			q.push(to);
		}
	}

	V<P<int, int>> ord(N);
	for (int i = 0; i < N; ++i) ord[i] = {depth[i],i};
	sort(ALL(ord), greater<P<int, int>>());
	
	V<P<int, int>> val(N);
	for (int i = 0; i < N; ++i){
		int to = ord[i].second;
		if (child[to].empty()) {
			val[to] = { 0,X[to] };
			continue;
		}

		int suml = 0, sumr = 0;
		V<int> cost;
		for(auto from: child[to]){
			suml += val[from].first;
			sumr += val[from].second;
			cost.push_back(val[from].second - val[from].first);
		}
		corner(X[to] < suml, "IMPOSSIBLE");
		
		V<int> dp(5001, 0); dp[0] = 1;
		for(auto e:cost){
			for(int j = 5000; 0 <= j; --j){
				if (j - e >= 0 && dp[j - e]) dp[j] = 1;
			}
		}

		int diff = X[to] - suml;
		for(;0 <= diff; --diff){
			if (dp[diff]) break;
		}
		sumr -= diff;
		val[to] = { min(sumr,X[to]),max(sumr,X[to]) };
	}
	cout << "POSSIBLE" << endl;

	return 0;
}



Measured memory_bytes: 384