#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct node{ int bwhite, bbrack, wwhite, wbrack; };

int n, p[1000], x[1000];
vector<int> g[1000];
node v[1000];

void display(vector<vector<int>> a) {
	for (int i = 0; i < a.size(); i++) {
		for (int j = 0; j < a[i].size(); j++) {
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;
}

void check(int num) {
	v[num] = node{ INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX};

	for (int i = 0; i < g[num].size(); i++) {
		check(g[num][i]);
	}
	//cout << "num:" << num << endl;
	//cout << endl;

	//cout << "a" << endl;
	int brack = 0, white = 0;
	int bbsum = 0, bwsum = 0, wwsum = 0, wbsum = 0;
	vector<int> bvec, wvec;
	for (int i = 0; i < g[num].size(); i++) {
		node a = v[g[num][i]];
		if (a.bbrack == INT32_MAX && a.wwhite == INT32_MAX) {
			return;
		}

		if (a.bbrack != INT32_MAX && a.wwhite == INT32_MAX)brack += a.bbrack;
		if (a.bbrack == INT32_MAX && a.wwhite != INT32_MAX)white += a.wwhite;

		if (a.bbrack != INT32_MAX && a.wwhite != INT32_MAX) {
			bvec.push_back(g[num][i]);
			wvec.push_back(g[num][i]);
			bbsum += v[g[num][i]].bbrack;
			bwsum += v[g[num][i]].bwhite;
			wwsum += v[g[num][i]].wwhite;
			wbsum += v[g[num][i]].wbrack;
		}
	}
	if (brack <= x[num])v[num].bbrack = x[num];
	if (white <= x[num])v[num].wwhite = x[num];
	//cout << "b" << endl;

	/*for (int i = 0; i < bvec.size(); i++) {
		cout << "v:" << bvec[i] << " v[" << bvec[i] << "].bbrack:" << v[bvec[i]].bbrack << " v[" << bvec[i] << "].bwhite:" << v[bvec[i]].bwhite << endl;
	}*/

	//大きさは動的にしなければいけない
	vector<vector<int>> dpb(bvec.size() + 1, vector<int>(x[num] - brack + 1, INT32_MAX));
	vector<vector<int>> dpw(wvec.size() + 1, vector<int>(x[num] - white + 1, INT32_MAX));

	//cout << "c" << endl;
	dpb[0][0] = 0; dpw[0][0] = 0;
	for (int i = 0; i < dpb.size()-1; i++) {
		//cout << "i:" << i << endl;
		//cout << "x[num] - brack:" << x[num] - brack << endl;
		for (int j = 0; j <= x[num] - brack; j++) {
			//cout << "j:" << j << endl;
			if (dpb[i][j] != INT32_MAX) {
				//cout << "j:" << j << endl;
				if (j + v[bvec[i]].wbrack <= x[num] - brack) {
					dpb[i + 1][j + v[bvec[i]].wbrack] = min(dpb[i + 1][j], dpb[i][j] + v[bvec[i]].wwhite);
				}
				if (j + v[bvec[i]].bbrack <= x[num] - brack) {
					dpb[i + 1][j+v[bvec[i]].bbrack] = min(dpb[i + 1][j+v[bvec[i]].bbrack], dpb[i][j]+v[bvec[i]].bwhite);
				}
			}
		}

		for (int j = 0; j <= x[num] - white; j++) {
			if (dpw[i][j] != INT32_MAX) {
				if (j + v[wvec[i]].bwhite <= x[num] - white) {
					dpw[i + 1][j + v[wvec[i]].bwhite] = min(dpw[i + 1][j], dpw[i][j] + v[wvec[i]].bbrack);
				}
				if (j + v[wvec[i]].wwhite <= x[num] - white) {
					dpw[i + 1][j + v[wvec[i]].wwhite] = min(dpw[i + 1][j + v[wvec[i]].wwhite], dpw[i][j] + v[wvec[i]].wbrack);
				}
			}
		}
	}
	//cout << "d" << endl;
	//display(dpb);
	//display(dpw);


	int bwmin = INT32_MAX, wbmin = INT32_MAX;
	for (int i = 0; i <= x[num]-brack; i++) {
		if (dpb[bvec.size()][i] != INT32_MAX) {
			bwmin = min(dpb[bvec.size()][i], bwmin);
			v[num].bwhite = bwmin;
		}
	}
	for (int i = 0; i <= x[num] - white; i++) {
		if (dpw[wvec.size()][i] != INT32_MAX) {
			wbmin = min(dpw[wvec.size()][i], wbmin);
			v[num].wbrack = wbmin;
		}
	}

	//ここか、dpがミス
	if (brack <= x[num]) {
		v[num].bwhite += white;
		v[num].bbrack = (v[num].bwhite == INT32_MAX)?INT32_MAX:v[num].bbrack;
	}
	if (white <= x[num]) {
		v[num].wbrack += brack;
		v[num].wwhite = (v[num].wbrack == INT32_MAX)?INT32_MAX:v[num].wwhite;
	}

	//cout << "v:" << num << " v[" << num << "].bbrack:" << v[num].bbrack << " v[" << num << "].bwhite:" << v[num].bwhite << endl;
	//cout << "v:" << num << " v[" << num << "].wwhite:" << v[num].wwhite << " v[" << num << "].wbrack:" << v[num].wbrack << endl;
}

int main() {
	cin >> n;
	for (int i = 1; i < n; i++) {
		cin >> p[i];
		g[p[i] - 1].push_back(i);
	}
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}

	check(0);

	if ((v[0].bbrack != INT32_MAX) || (v[0].wwhite != INT32_MAX)) {
		cout << "POSSIBLE" << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}

	/*for (int i = 0; i < n; i++) {
		cout << endl;
		cout << "v:" << i << " v[" << i << "].bbrack:" << v[i].bbrack << " v[" << i << "].bwhite:" << v[i].bwhite << endl;
		cout << "v:" << i << " v[" << i << "].wwhite:" << v[i].wwhite << " v[" << i << "].wbrack:" << v[i].wbrack << endl;
	}*/
	
}

Measured memory_bytes: 2304