#include <bits/stdc++.h>
using namespace std;
template <typename T = long long>
inline T IN() {
  T x;
  cin >> x;
  return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
  cin >> head;
  CIN(move(tail)...);
}
template <typename T = string>
inline void eputs(T s) {
  cout << s << "\n";
  exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
template <typename T>
using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using PQ = priority_queue<T>;
const long long INF = 1e9;
const long long MOD = 1e9 + 7;
const long long LINF = 1e18;
const double PI = atan(1.0) * 4.0;
const long long dw[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dh[] = {0, 1, 1, 1, 0, -1, -1, -1};
vector<vector<long long>> G;
vector<long long> X;
long long dp[1010];
signed main() {
  long long N;
  CIN(N);
  G.resize(N);
  for (long long i = 0; i < (N - 1); ++i) {
    long long P;
    CIN(P);
    P--;
    G[P].emplace_back(i + 1);
  }
  X.resize(N);
  for (auto &youso_ : (X)) cin >> youso_;
  function<void(long long, long long)> dfs = [&](long long v, long long par) {
    bitset<5001> now, nex;
    now.set(0);
    long long sum = 0;
    for (auto &(to) : (G[v])) {
      if (to == par) continue;
      dfs(to, v);
      nex |= now << dp[to];
      nex |= now << X[to];
      sum += dp[to] + X[to];
      swap(now, nex);
    }
    for (long long i = X[v]; i >= 0; i--) {
      if (now[i]) {
        dp[v] = sum - i;
        return;
      }
    }
    eputs("IMPOSSIBLE");
  };
  dfs(0, -1);
  cout << "POSSIBLE"
       << "\n";
}
