#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int minO[1010];
int indegree[1010];
vector<int> children[1010];
int sumTo[1010];
int X[1010];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N - 1; ++i) {
    int push;
    scanf("%d", &push);
    push--;
    children[push].push_back(i + 1);
    if (0) printf(" children[%d].PB(%d)\n", push, i + 1);
    indegree[i + 1] = 1;
  }
  for (int i = 0; i < N; ++i) {
    scanf("%d", &X[i]);
  }
  vector<int> toposort;
  toposort.push_back(0);
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int ck = q.front();
    q.pop();
    for (int n : children[ck]) {
      q.push(n);
      toposort.push_back(n);
    }
  }
  reverse(toposort.begin(), toposort.end());
  bool possible = true;
  for (int x : toposort) {
    sumTo[x] = X[x];
    if (!possible) break;
    int goal = X[x];
    if (0) printf("ts %d goal %d\n", x, goal);
    if (((int)((children[x]).size())) == 0) {
      if (goal < 0) {
        possible = false;
        break;
      }
      continue;
    }
    unordered_map<int, int> dic;
    vector<int> keys;
    bool npc = true;
    for (int child : children[x]) {
      unordered_map<int, int> newdic;
      vector<int> toAdd;
      int a = minO[child];
      int b = X[child];
      if (0) printf(" child = %d, a = %d, b = %d\n", child, a, b);
      if (npc) {
        npc = false;
        if (a <= goal) {
          newdic[a] = b;
          toAdd.push_back(a);
        }
        if (b <= goal) {
          newdic[b] = a;
          if (a != b) {
            toAdd.push_back(b);
          }
        }
      }
      for (int key : keys) {
        if (key + a <= goal) {
          int cost = dic[key] + b;
          if (newdic.find(key + a) == newdic.end()) toAdd.push_back(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.push_back(key + b);
          if (newdic.find(key + b) == newdic.end() || cost < newdic[key + b]) {
            newdic[key + b] = cost;
          }
        }
      }
      for (int adding : toAdd) {
        keys = toAdd;
      }
      dic = newdic;
    }
    for (int key : keys) {
      if (0) printf(" key %d -> %d\n", key, dic[key]);
    }
    int bestR = 1000000000;
    for (int key : keys) {
      if (dic[key] < bestR) {
        bestR = dic[key];
      }
    }
    if (bestR == 1000000000) {
      possible = false;
      break;
    }
    if (0) printf("minO[%d] = %d\n", x, bestR);
    minO[x] = bestR;
  }
  if (possible) {
    printf("POSSIBLE\n");
  } else {
    printf("IMPOSSIBLE\n");
  }
  return 0;
}
