#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
int pa[2000], x[2000];
int dp[6000000];
H a[2000];
H b[2000];
vector<int>e[2000];
signed main() {
	cin >> n;
	for (int i = 2; i <= n; i++) {
		cin >> pa[i];
		e[pa[i]].push_back(i);
	}
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
		b[i].y = i;
		b[i].x = Inf;
	}
	queue<int>q;
	q.push(1);
	b[1].x = 0;
	while (!q.empty()) {
		int t = q.front(); q.pop();
		for (int i = 0; i < e[t].size(); i++) {
			if (b[e[t][i]].x > b[t].x) {
				b[e[t][i]].x = b[t].x + 1;
				q.push(e[t][i]);
			}
		}
	}
	sort(b + 1, b + 1 + n);
	for (int i = n; i > 0; i--) {
		int t = b[i].y;
		if (e[t].size() == 0) {
			a[t].x = x[t];
			continue;
		}
		for (int j = 0; j <= x[t]; j++) {
			dp[j] = Inf;
		}
		if (a[e[t][0]].x <= x[t]) dp[a[e[t][0]].x] = a[e[t][0]].y;
		if (a[e[t][0]].y <= x[t]) dp[a[e[t][0]].y] = a[e[t][0]].x;
		for (int j = 1; j < e[t].size(); j++) {
			for (int z = x[t]; z >= 0; z--) {
				int k = dp[z];
				dp[z] = Inf;
				if (k < Inf && z + a[e[t][j]].x <= x[t]) {
					chmin(dp[z + a[e[t][j]].x], k + a[e[t][j]].y);
				}
				if (k < Inf && z + a[e[t][j]].y <= x[t]) {
					chmin(dp[z + a[e[t][j]].y], k + a[e[t][j]].x);
				}
			}
		}
		int res = Inf;
		for (int j = 0; j <= x[t]; j++) {
			res = min(res, dp[j]);
		}
		if (res == Inf) {
			cout << "IMPOSSIBLE\n";
			return 0;
		}
		else {
			a[t].x = x[t];
			a[t].y = res;
		}
	}
	cout << "POSSIBLE\n";
}

Measured memory_bytes: 384