#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T>
inline bool chmin(T &x, const T &y) {
  if (x > y) {
    x = y;
    return 1;
  }
  return 0;
}
template <typename T>
inline bool chmax(T &x, const T &y) {
  if (x < y) {
    x = y;
    return 1;
  }
  return 0;
}
struct IOSET {
  IOSET() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(10);
  }
} ioset;
constexpr int max_x = 5010;
int n;
vector<ll> x;
vector<vector<int>> g;
pair<ll, ll> dfs(int v) {
  if (!(int)(g[v]).size()) return pair<ll, ll>(0, x[v]);
  vector<pair<ll, ll>> vec;
  for (int u : g[v]) vec.push_back(dfs(u));
  ll sum = 0;
  for (pair<ll, ll> p : vec) sum += (p.first + p.second);
  vector<vector<bool>> dp((int)(vec).size() + 1, vector<bool>(max_x, false));
  dp[0][0] = true;
  for (int i = 0; i < ((int)(vec).size()); ++i)
    for (int j = 0; j < (max_x); ++j) {
      if (!dp[i][j]) continue;
      if (j + vec[i].first < max_x) dp[i + 1][j + vec[i].first] = true;
      if (j + vec[i].second < max_x) dp[i + 1][j + vec[i].second] = true;
    }
  ll mn = INF;
  pair<ll, ll> ans(-1, -1);
  for (int i = 0; i < (max_x); ++i) {
    if (!dp[(int)(vec).size()][i]) continue;
    if (i > x[v]) continue;
    if (chmin(mn, min(x[v], sum - i))) ans = pair<ll, ll>(x[v], sum - i);
  }
  if (mn == INF) {
    cout << "IMPOSSIBLE\n";
    exit(0);
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  x.resize(n);
  g.resize(n);
  for (int i = (1); i < (n); ++i) {
    int p;
    cin >> p;
    --p;
    g[p].push_back(i);
  }
  for (int i = 0; i < (n); ++i) cin >> x[i];
  dfs(0);
  cout << "POSSIBLE\n";
  return 0;
}
