#include <bits/stdc++.h>
using namespace std;
#define fbo find_by_order
#define ook order_of_key
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define MOD 998244353
#define MID (l+r)/2
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define mx 200003
#define pc(x) putchar_unlocked(x);

int dep[1003][5005],n,p[1003],x[mx];
vector<int>g[1003];

int dp(int now,int ke,int tot){
	if(ke==g[now].size())return 0;
	int&ret=dep[g[now][ke]][tot];
	if(ret!=-1)return ret;
	ret=1e9;
	if(x[g[now][ke]]+tot<=x[now])ret=min(ret,dp(now,ke+1,tot+x[g[now][ke]])+dp(g[now][ke],0,0));
	if(dp(g[now][ke],0,0)+tot<=x[now])ret=min(ret,dp(now,ke+1,tot+dp(g[now][ke],0,0))+x[g[now][ke]]);
	return ret;
}

int main(){
	cin>>n;
	for(int i=2;i<=n;i++){
		cin>>p[i];
		g[p[i]].pb(i);
	}
	for(int i=1;i<=n;i++)cin>>x[i];
	reset(dep,-1);
	if(dp(1,0,0)==1e9)cout<<"IMPOSSIBLE\n";
	else cout<<"POSSIBLE\n";
	
}


