#include <iostream>
#include <vector>

using namespace std;

int main(){
	int N;
	while(cin >> N){
		vector<vector<int>> g(N);
		for(int i=1;i<N;i++){
			int p; cin >> p;
			g[p-1].push_back(i);
		}
		vector<int> X(N);
		for(int& t : X) cin >> t;
		vector<int> Y(N, 0);
		bool ok = true;
		for(int i=N-1;i>=0;i--){
			vector<int> dp(X[i]+1, 0);
			vector<int> next(X[i]+1, 0);
			dp[0] = 1;
			int sum = 0;
			for(int t : g[i]){
				fill(next.begin(), next.end(), 0);
				for(int j=0;j<=X[i];j++){
					if(!dp[j]) continue;
					if(j+X[t] <= X[i]) next[j+X[t]] = 1;
					if(j+Y[t] <= X[i]) next[j+Y[t]] = 1;
				}
				dp = next;
				sum  += X[t] + Y[t];
			}
			int maxVal = -1;
			for(int j=0;j<=X[i];j++) if(dp[j]) maxVal = j;
			if(maxVal < 0){
				ok = false;
				break;
			}
			Y[i] = sum - maxVal;
		}
		cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	}
}