#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <cstdlib>
#include <memory>
#include <queue>
#include <cassert>
#include <cmath>
#include <ctime>
#include <complex>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

using namespace std;

#define ws ws_____________________
#define y1 y1_____________________
#define y0 y0_____________________
#define left left_________________
#define right right_______________
#define next next_________________
#define prev prev_________________
#define hash hash_________________

#define pb push_back
#define fst first
#define snd second
#define mp make_pair 
#define sz(C) ((int) (C).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define all(C) begin(C), end(C)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef long double ld;
typedef complex<double> cd;

#ifdef LOCAL
#define eprintf(args...) fprintf(stderr, args), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define FILE_NAME "a"

const int MAXN = 1e3 + 10;
const int MAXX = 5e3 + 10;

int n;
vi g[MAXN];
int X[MAXN];

bool read() {
	if  (scanf("%d", &n) < 1) {
		return 0;
	}
	forn(i, n) {
		g[i].clear();
	}
	for (int i = 1; i < n; ++i) {
		int p;
		scanf("%d", &p);
		--p;
		g[p].pb(i);
	}
	forn(i, n) {
		scanf("%d", &X[i]);
	}
	return 1;
}

const int INF = 1e9;

int dp2[MAXN][MAXX];
int dp[MAXN];

int cur_dp[MAXX];

void remin(int& x, int y) {
	if  (x > y) {
		x = y;
	}
}

void dfs(int v) {
	for (int to : g[v]) {
		dfs(to);
	}

	dp[v] = INF;
	{
		int s = 0;
		for (int to : g[v]) {
			if  (dp[to] >= INF) {
				s = INF;
				break;
			} else {
				s += dp[to];
			}
		}
		if  (s <= X[v]) {
			remin(dp[v], X[v]);
		} else {
			return;
		}
	}

	forn(x, MAXX) {
		cur_dp[x] = INF;
	}
	cur_dp[0] = 0;
	for (int to : g[v]) {
		static int ndp[MAXX];
		forn(x, MAXX) {
			ndp[x] = INF;
		}

		vi curs;
		forn(cur, MAXX) {
			if  (dp2[to][cur] < INF) {
				curs.pb(cur);
			}
		}

		forn(was, MAXX) {
			if  (cur_dp[was] >= INF) {
				continue;
			}

			for (int cur : curs) {
				const int dp_son = dp2[to][cur];
				assert(dp_son < INF);

				if  (was + cur < MAXX) {
					remin(ndp[was + cur], cur_dp[was] + dp_son);
				}
				if  (was + dp_son < MAXX) {
					remin(ndp[was + dp_son], cur_dp[was] + cur);
				}
			} 
		}

		memcpy(cur_dp, ndp, sizeof cur_dp);
	}

	forn(sons, X[v] + 1) {
		remin(dp[v], cur_dp[sons]);
	}

	assert(dp[v] <= X[v]);
	
	// global min is ready


	forn(s, MAXX) {
		dp2[v][s] = INF;
	}

	forn(sons, X[v] + 1) {
		const int a = X[v];
		const int b = cur_dp[sons];
		if  (a < MAXX) {
			remin(dp2[v][a], b);
		}
		if  (b < MAXX) {
			remin(dp2[v][b], a);
		}
	}
}

bool solve() {
	const int r = 0;

	dfs(r);

	if  (dp[r] >= INF) {
		return 0;
	}
	return 1;
}

int main() {
#ifdef LOCAL
	freopen(FILE_NAME ".in", "r", stdin);
	// freopen(FILE_NAME ".out", "w", stdout);
#endif

	while (read()) {
		puts(solve() ? "POSSIBLE" : "IMPOSSIBLE");
	}

#ifdef LOCAL
	cerr.precision(5);
	cerr << "Time: " << fixed << (double) clock() / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}


Measured memory_bytes: 19968