#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long INF = 1LL << 60;
const long long mod = 1e9 + 7;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
long long n;
vector<long long> p;
vector<long long> x;
vector<vector<long long>> g;
vector<long long> sum;
vector<long long> dp;
string ans;
void dfs(long long v, long long p) {
  for (long long nv : g[v]) {
    if (nv == p) continue;
    dfs(nv, v);
  }
  long long sdp[5100];
  for (long long i = 0; i < 5100; i++) sdp[i] = INF;
  sdp[0] = x[v];
  sdp[x[v]] = 0;
  for (long long nv : g[v]) {
    for (long long i = 5000; i >= 0; --i) {
      long long tmp = sdp[i];
      if (i + x[nv] <= 5000) {
        chmin(sdp[i + x[nv]], tmp + dp[nv]);
        sdp[i] = INF;
      }
      if (i + dp[nv] <= 5000) {
        chmin(sdp[i + dp[nv]], tmp + x[nv]);
        sdp[i] = INF;
      }
    }
  }
  for (long long i = 0; i <= x[v]; ++i) {
    chmin(dp[v], sdp[i]);
  }
  if (dp[v] == INF) ans = "IMPOSSIBLE";
}
void solve() {
  cin >> n;
  p.resize(n, -1);
  x.resize(n);
  g.assign(n, vector<long long>());
  for (long long i = 0; i < n - 1; i++) {
    cin >> p[i + 1];
    g[i].push_back(p[i + 1]);
    g[p[i + 1]].push_back(i);
  }
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  dp.assign(n, INF);
  ans = "POSSIBLE";
  dfs(0, -1);
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
