# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const long long MOD = 1000000000 + 7;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = 1LL << 60;//numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>g;
vector<edge>ed;
vector<Pll>pv;
set<LL>st;
map<Pll, LL>ma;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
string str, ss;
bool f;
LL n, m, s, t, h, w, k, q, p, ans, cnt, sum, a[5000], b[5000];
char c;
Pll dfs(int cur, int par) {
	vector<vector<LL>>dp(g[cur].size() + 1, vector<LL>(5002));
	vector<Pll>d(g[cur].size());
	rep(i, g[cur].size() + 1)rep(j, 5002)dp[i][j] = INF;
	rep(i, g[cur].size()) {
		d[i] = Pll(0, 0);
		int v = g[cur][i].to;
		if (v == par)continue;
		d[i] = dfs(v, cur);
	}
	dp[0][0] = 0;
	rep(i, g[cur].size()) {
		rep(j, 5002) {
			if (j + d[i].fir <= 5000) {
				dp[i + 1][j + d[i].fir] = min(dp[i + 1][j + d[i].fir], dp[i][j] + d[i].sec);
			}
			else {
				dp[i + 1][5001] = min(dp[i + 1][5001], dp[i][j] + d[i].sec);
			}
			swap(d[i].first, d[i].second);
			if (j + d[i].fir <= 5000) {
				dp[i + 1][j + d[i].fir] = min(dp[i + 1][j + d[i].fir], dp[i][j] + d[i].sec);
			}
			else {
				dp[i + 1][5001] = min(dp[i + 1][5001], dp[i][j] + d[i].sec);
			}
			swap(d[i].first, d[i].second);
		}
	}
	Pll res(0, 0);
	rep(i, 5002) {
		if (a[cur] >= dp[g[cur].size()][i]) {
			res.first = a[cur];
			res.sec = i;
			//cout <<cur<<" "<< res.first << " " << res.second << endl;
			return res;
		}
	}
	f = 1;
	//cout << cur << endl;
	return res;
}
int main() {
	cin >> n;
	g.resize(n);
	rep(i, n - 1) {
		LL x;
		cin >> x;
		x--;
		g[x].push_back(Edge{ i+1,0 });
		g[i+1].push_back(Edge{ x,0 });
	}
	rep(i, n) {
		cin >> a[i];
	}
	dfs(0,-1);
	if (f)
		cout << "IMPOSSIBLE" << endl;
	else
		cout << "POSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 58288