#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e15;
const long long int MOD = 1e9 + 7;
long long int n;
vector<vector<long long int>> edge;
vector<long long int> x;
pair<long long int, long long int> dfs(long long int v) {
  vector<pair<long long int, long long int>> vp;
  for (long long int u : edge[v]) {
    vp.push_back(dfs(u));
  }
  vector<vector<long long int>> dp(((long long int)(vp).size()) + 1,
                                   vector<long long int>(5001, INF));
  dp[0][0] = 0;
  for (long long int i = 0; i < (((long long int)(vp).size())); ++i) {
    for (long long int j = 0; j < (5000); ++j) {
      if (j + vp[i].first <= 5000) {
        dp[i + 1][j + vp[i].first] =
            min(dp[i + 1][j + vp[i].first], dp[i][j] + vp[i].second);
      }
      if (j + vp[i].second <= 5000) {
        dp[i + 1][j + vp[i].second] =
            min(dp[i + 1][j + vp[i].second], dp[i][j] + vp[i].first);
      }
    }
  }
  long long int ans = -1;
  for (long long int i = 5000; i >= 0; i--) {
    if (dp[((long long int)(vp).size())][i] <= x[v]) {
      ans = i;
    }
  }
  if (ans == -1) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
  return {x[v], ans};
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  edge = vector<vector<long long int>>(n + 1, vector<long long int>());
  for (long long int i = 2; i <= n; i++) {
    long long int p;
    cin >> p;
    edge[p].push_back(i);
  }
  x = vector<long long int>(n + 1);
  for (long long int i = 0; i < (n); ++i) cin >> x[i + 1];
  dfs(1);
  cout << "POSSIBLE" << endl;
  return 0;
}
