#include<ctime>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath> 
#include<cstring> 
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
#define pii pair<int,int>
#define sz(s) s.size()
#define all(s) (s.begin(),s.end())
inline void Fail(){
	printf("IMPOSSIBLE");
	exit(0);
}

const int maxn=1005;
const int maxm=5005;
int n;
vector<int>edge[maxn];
int dp[2][maxn],w[maxn],tmp[2][maxn][maxm];

void dfs(int x,int p){
	vector<int>son;
	rep(i,edge[x].size()){
		int y=edge[x][i];
		if(y==p)continue;
		dfs(y,x);
		son.push_back(y);
	}
	if(son.empty()){
		dp[0][x]=dp[1][x]=0;
		return;
	}
	rep(i,son.size())rep(j,w[x]+1)rep(k,2)tmp[k][i][j]=INF;
	int mn[2]={INF,INF};
	rep(k,2)rep(i,son.size())rep(j,w[x]+1){
		if(j>=w[son[i]])tmp[k][i][j]=min(tmp[k][i][j],(!i?0:tmp[k][i-1][j-w[son[i]]])+dp[k^1][son[i]]);
		if(j>=dp[k][son[i]])tmp[k][i][j]=min(tmp[k][i][j],(!i?0:tmp[k][i-1][j-dp[k][son[i]]])+w[son[i]]);
		if(i==son.size()-1)mn[k]=min(mn[k],tmp[k][i][j]);
	}
	if(mn[0]==INF&&mn[1]==INF)Fail();
	dp[1][x]=mn[0];
	dp[0][x]=mn[1];
//	printf("%d %d %d\n",x,dp[0][x],dp[1][x]);
}

int main(){
	scanf("%d",&n);
	for(int i=2;i<=n;i++){
		int p;
		scanf("%d",&p);
		edge[p].push_back(i);
		edge[i].push_back(p);
	}
	REP(i,n)scanf("%d",&w[i]);
	dfs(1,-1);
	printf("POSSIBLE");
	return 0;
}