#include<cstdio>
#include<algorithm>
#include<vector>
#include<bitset>
using namespace std;
vector<int>E[1010];
int D[5010], n, w[1010], chk;
bool DFS(int a) {
	int i;
	if (E[a].empty()) {
		D[a] = 0;
		return true;
	}
	int s = 0, r = 0;
	bitset<5100>T;
	T[0] = 1;
	for (auto &x : E[a]) {
		if (!DFS(x))return false;
		s += w[x] + D[x];
		r += min(w[x], D[x]);
		T = (T << w[x]) | (T << D[x]);
	}
	if (r > w[a]) return false;
	for (i = w[a]; i >= 0; i--)if (T[i])break;
	int pv = i;
	D[a] = s - pv;
	return true;
}
int main() {
	int i, a;
	scanf("%d", &n);
	for (i = 2; i <= n; i++) {
		scanf("%d", &a);
		E[a].push_back(i);
	}
	for (i = 1; i <= n; i++)scanf("%d", &w[i]);
	if (!DFS(1))puts("IMPOSSIBLE");
	else puts("POSSIBLE");
}