#include<iostream>
#include<vector>
#include<bitset>
#include<utility>
using namespace std;
int N;
vector<int>G[1000];
int X[1000];
bool ans;
pair<int,int>dfs(int u)
{
	bitset<5001>now;
	now[0]=1;
	int sum=0;
	for(int i=0;i<G[u].size();i++)
	{
		pair<int,int>p=dfs(G[u][i]);
		sum+=p.first+p.second;
		now=now<<p.first|now<<p.second;
	}
	int id=X[u];
	while(id>=0&&!now[id])id--;
	if(id<0)ans=1;
	return{X[u],sum-id};
}
int main()
{
	cin>>N;
	for(int i=1;i<N;i++)
	{
		int p;cin>>p;
		G[p-1].push_back(i);
	}
	for(int i=0;i<N;i++)cin>>X[i];
	dfs(0);
	cout<<(ans?"IM":"")<<"POSSIBLE"<<endl;
}