#include <bits/stdc++.h>
using ll = long long;
using P = std::pair<ll, ll>;
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b) {
  return a < b && (a = b, true);
}
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b) {
  return a > b && (a = b, true);
}
const ll MOD = 1e9 + 7;
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  ll n;
  std::cin >> n;
  std::vector<std::vector<ll>> graph(n);
  for (ll(i) = (1); i < (n); i++) {
    ll p;
    std::cin >> p;
    p--;
    graph[p].push_back(i);
  }
  std::vector<ll> d(n), x(n);
  for (ll(i) = (0); i < (n); i++) std::cin >> x[i];
  for (ll(i) = (0); i < (n); i++) {
    if (graph[i].empty()) {
      d[i] = 0;
    } else {
      ll sum = 0;
      for (ll next : graph[i]) sum += x[next] + d[next];
      std::vector<std::bitset<5001>> dp(graph[i].size() + 1,
                                        std::bitset<5001>(false));
      dp[0][0] = true;
      for (ll(j) = (0); j < (graph[i].size()); j++) {
        for (ll(k) = (0); k < (5001); k++) {
          dp[j + 1][k] = ((k >= x[graph[i][j]]) && dp[j][k - x[graph[i][j]]]) |
                         ((k >= d[graph[i][j]]) && dp[j][k - d[graph[i][j]]]);
        }
      }
      ll val = -1;
      for (ll j = x[i]; j >= 0; j--) {
        if (dp[graph[i].size()][j]) {
          val = j;
          break;
        }
      }
      if (val == -1) {
        std::cout << "IMPOSSIBLE\n";
        return 0;
      }
      d[i] = sum - val;
    }
  }
  std::cout << "POSSIBLE\n";
  return 0;
}
