#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 1010

vector<int> chi[SIZE];
int p[SIZE], x[SIZE];

pair<int,int> dfs(int now){
  
  if(chi[now].size() == 0){
    return {0, x[now]};
  }

  int sum = 0, min_g = 0;
  
  for(int i=0;i<chi[now].size();i++){
    auto ret = dfs(chi[now][i]);

    if(ret.first == -1) return {-1,-1};

    min_g += ret.first;
    sum += ret.second;
  }

  if(min_g > x[now]){
    return {-1, -1};
  }
  
  if(sum - min_g <= x[now]){
    sum += x[now] - (sum - min_g);
  }else{
    sum += x[now] - min_g;
    min_g = x[now];
  }
  
  return {min_g, sum};
}

int main(){
  int n;

  scanf("%d",&n);
  
  p[0] = -1;
  for(int i=1;i<n;i++){
    scanf("%d",p+i);
    chi[p[i]-1].push_back(i);
  }

  for(int i=0;i<n;i++){
    scanf("%d",x+i);
  }

  auto ret = dfs(0);

  if(ret.first != -1){
    puts("POSSIBLE");
  }else{
    puts("IMPOSSIBLE");
  }
  
  return 0;
}

