#include <bits/stdc++.h>
const double pi = 3.14159265358979323846264338;
const int64_t mod = 1000000007;
template <typename T>
void scan1(T& x) {
  if (false) fprintf(stderr, "unknown type\n");
}
template <>
void scan1(int64_t& x) {
  if (scanf("%" PRId64, &x) < 0) exit(0);
}
template <>
void scan1(std::string& x) {
  if (not(std::cin >> x)) exit(0);
}
template <>
void scan1(std::vector<int64_t>& xs) {
  for (int64_t& x : xs) scan1(x);
}
void scan() {}
template <typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x);
  scan(xs...);
}
struct Solver {
  Solver() {
    if (false) fprintf(stderr, "--------Solver begin--------\n");
  }
  ~Solver() {
    if (false) fprintf(stderr, "--------Solver end--------\n");
  }
  std::pair<int64_t, int64_t> f(std::vector<std::pair<int64_t, int64_t>> xs,
                                int64_t z) {
    if (xs.size() == 0) return std::make_pair(z, 0);
    int64_t inf = 1LL << 53;
    std::vector<int64_t> dp1(5001, inf), dp2(5001, inf);
    dp1[xs[0].first] = std::min(dp1[xs[0].first], xs[0].second);
    dp1[xs[0].second] = std::min(dp1[xs[0].second], xs[0].first);
    for (int64_t i = 1; i < (int64_t)xs.size(); ++i) {
      for (int64_t k = 5000; k >= 0; --k) {
        dp2[k] = inf;
        if (k - xs[i].first >= 0)
          dp2[k] = std::min(dp2[k], dp1[k - xs[i].first] + xs[i].second);
        if (k - xs[i].second >= 0)
          dp2[k] = std::min(dp2[k], dp1[k - xs[i].second] + xs[i].first);
      }
      std::swap(dp1, dp2);
    }
    for (int64_t i = 0; i < 20; ++i) {
      if (false)
        fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, 69, "i",
                "dp1[i]", i, dp1[i]);
      ;
    }
    for (int64_t i = z; i >= 0; --i) {
      if (dp1[i] != inf) {
        return std::make_pair(i, dp1[i]);
      }
    }
    return std::make_pair(-1, -1);
  }
  std::vector<int64_t> graph[1123];
  std::pair<int64_t, int64_t> dfs(int64_t i) {
    std::vector<std::pair<int64_t, int64_t>> xs;
    for (int64_t next : graph[i]) {
      auto t = dfs(next);
      if (t.first == -1 or t.second == -1) return std::make_pair(-1, -1);
      xs.push_back(t);
    }
    auto xy = f(xs, ws[i]);
    return std::make_pair(ws[i], xy.second);
  }
  std::vector<int64_t> ws;
  void solve() {
    int64_t n;
    scan(n);
    for (int64_t i = 2; i <= n; ++i) {
      int64_t t;
      scan(t);
      graph[t].push_back(i);
    }
    ws.resize(n + 1);
    for (int64_t i = 1; i <= n; ++i) scan(ws[i]);
    auto t = dfs(1);
    auto res = t.first != -1 and t.second != -1;
    puts(res ? "POSSIBLE" : "IMPOSSIBLE");
  }
};
int main() {
  for (;;) std::unique_ptr<Solver>(new Solver())->solve();
}
