#include <bits/stdc++.h>
int NextInt() {
  int tmp;
  if (scanf("%d", &tmp) != 1) {
    throw std::runtime_error("NextInt");
  }
  return tmp;
}
constexpr int kMaxN = 10000 + 3;
constexpr int kMaxmost = 10000 + 5;
constexpr int kInf = 1e9;
int most[kMaxmost];
int minDiff[kMaxN];
void TravelTree(const std::vector<std::vector<int>>& son, int u) {
  for (int v : son[u]) {
    TravelTree(son, v);
  }
  static int dp[2][kMaxmost];
  int flag = 1;
  for (int i = 0; i <= most[u]; i += 1) {
    dp[!flag][i] = 0;
  }
  for (int v : son[u]) {
    auto dpNow = dp[flag];
    auto dpPre = dp[!flag];
    for (int sumSame = 0; sumSame <= most[u]; sumSame += 1) {
      dpNow[sumSame] = kInf;
      if (sumSame >= most[v]) {
        dpNow[sumSame] = dpPre[sumSame - most[v]] + minDiff[v];
      }
      if (sumSame >= minDiff[v]) {
        dpNow[sumSame] =
            std::min(dpNow[sumSame], dpPre[sumSame - minDiff[v]] + most[v]);
      }
    }
    flag ^= 1;
  }
  auto dpFinal = dp[!flag];
  minDiff[u] = kInf;
  for (int sumSame = 0; sumSame <= most[u]; sumSame += 1) {
    minDiff[u] = std::min(dpFinal[sumSame], minDiff[u]);
  }
}
int main() {
  int n = NextInt();
  std::vector<std::vector<int>> son(n);
  for (int i = 1; i < n; ++i) {
    int parent = NextInt();
    son[parent - 1].push_back(i);
  }
  for (int i = 0; i < n; ++i) {
    most[i] = NextInt();
  }
  int root = 0;
  TravelTree(son, root);
  puts(minDiff[root] == kInf ? "IMPOSSIBLE" : "POSSIBLE");
  return 0;
}
