#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N=1005,inf=10005;
int dp[2][N],val[N],dp2[N][inf];
vi v[N];
int fun(int ind,int sz,int col,int curr,int done=0)
{
  if(done>val[curr]) return inf;
  if(ind==sz) return 0;
  if(dp2[ind][done]!=-1) return dp2[ind][done];
  int ans=inf,v1=v[curr][ind];
  //take this of same col
  ans=dp[1-col][v1]+fun(ind+1,sz,col,curr,done+val[v1]);
  //take this of other col
  ans=min(ans,val[v1]+fun(ind+1,sz,col,curr,done+dp[col][v1]));
  return dp2[ind][done]=ans;
}
void dfs(int u)
{
  for(int v1:v[u])
    dfs(v1);
  rep(k,0,2)//assign colour i to this node, and minimise other colour
    {
      rep(i,0,sz(v[u])) rep(j,0,inf) dp2[i][j]=-1;
      dp[1-k][u]=fun(0,sz(v[u]),k,u);
    }
  if(dp[0][u]>=inf && dp[1][u]>=inf)
    {
      cout<<"IMPOSSIBLE"<<endl;
      exit(0);
    }
}
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int n,x;
  cin>>n;
  rep(i,2,n+1)
    {
      cin>>x;
      v[x].pb(i);
    }
  rep(i,1,n+1) cin>>val[i];
  dfs(1);
  cout<<"POSSIBLE"<<endl;
  return 0 ;
}
