//This code uses a C++ Template written by Marcus Handley
//Adapated from Compeitive Programming 3 - A new lower bound
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <unordered_map>
using namespace std;

#define INF 1000000000
#define MOD 1000000007
#define LOG_LEVEL 0
#define PB push_back
#define P push
#define F first
#define S second
#define ILLP if(LOG_LEVEL)printf
#define SZ(x) ((int)((x).size()))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define ALL(x) x.begin(),x.end()
#define SMAX(x, y) ((x) = max((x), (y)))
#define SMIN(x, y) ((x) = min((x), (y)))
#define LOOP(x,n) for(int x = 0; x < n; ++x)


typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

typedef char byte;

int minO[1010];
//int parent[1000];
int indegree[1010];
vi children[1010];
int sumTo[1010];
int X[1010];

int main(){
  int N; scanf("%d",&N);
  LOOP(i, N-1){
    int P; scanf("%d",&P); P--;
    children[P].PB(i+1);
    ILLP(" children[%d].PB(%d)\n",P,i+1);
    //parent[i+1] = P;
    indegree[i+1] = 1;
  }
  LOOP(i, N){
    scanf("%d",&X[i]);
  }
  vi toposort; toposort.PB(0);
  queue<int> q; q.P(0);
  while (!q.empty()){
    int ck = q.front(); q.pop();
    for (int n: children[ck]){
      q.P(n);
      toposort.PB(n);
    }
  }
  reverse(ALL(toposort));
  bool possible = true;
  for (int x: toposort){
    sumTo[x] = X[x];
    if (!possible) break;
    int goal = X[x];
    ILLP("ts %d goal %d\n",x,goal);
    if (SZ(children[x])==0){
      if (goal<0){
        possible = false;
        break;
      }
      continue;
    }
    unordered_map<int,int> dic;
    vi keys;
    bool npc = true;
    for (int child: children[x]){
      unordered_map<int,int> newdic;
      vi toAdd;
      int a = minO[child];
      int b = X[child];
      ILLP(" child = %d, a = %d, b = %d\n",child,a,b);
      if (npc){
        npc = false;

        if (a<=goal){
          newdic[a] = b;
          toAdd.PB(a);
        }
        if (b<=goal){
          newdic[b] = a;
          if (a!=b){
            toAdd.PB(b);
          }
        }
      }
      for (int key: keys){
        if (key+a<=goal){
          int cost = dic[key]+b;
          if (newdic.find(key+a)==newdic.end()) toAdd.PB(key+a);
          if (newdic.find(key+a)==newdic.end() || cost<newdic[key+a]){
            newdic[key+a] = cost;
          }
        }
        if (key+b<=goal){
          int cost = dic[key]+a;
          if (newdic.find(key+b)==newdic.end()) toAdd.PB(key+b);
          if (newdic.find(key+b)==newdic.end() || cost < newdic[key+b]){
            newdic[key+b] = cost;
          }
        }
      }

      keys = toAdd;
      dic = newdic;
    }
    for (int key: keys){
      ILLP(" key %d -> %d\n",key,dic[key]);
    }
    int bestR = INF;
    for (int key: keys){
      if (dic[key]<bestR){
        bestR = dic[key];
      }
    }
    if (bestR==INF){
      possible = false;
      break;
    }
    ILLP("minO[%d] = %d\n",x,bestR);
    minO[x] = bestR;
  }
  if (possible){
    printf("POSSIBLE\n");
  } else{
    printf("IMPOSSIBLE\n");
  }
  return 0;
}


Measured memory_bytes: 512