#include <bits/stdc++.h>
using namespace std;
long long dfs(vector<vector<long long> > &adj, long long u,
              vector<long long> &w) {
  if (adj[u].size() == 0) return 0;
  vector<pair<long long, long long> > vec;
  long long sum = 0;
  for (auto v : adj[u]) {
    long long val = dfs(adj, v, w);
    if (val == -1) return -1;
    vec.push_back({val, w[v]});
    sum += val + w[v];
  }
  long long n = (long long)vec.size();
  vector<vector<bool> > dp(n + 1, vector<bool>(sum + 1, false));
  dp[0][0] = true;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= sum; j++) {
      if (dp[i][j] == false) continue;
      dp[i + 1][vec[i].first] = dp[i + 1][vec[i].second] = true;
    }
  }
  long long ret = -1;
  for (long long j = w[u]; j >= 0; j--) {
    if (dp[n][j]) {
      ret = sum - j;
      break;
    }
  }
  return ret;
}
signed main() {
  long long n;
  cin >> n;
  vector<vector<long long> > adj(n);
  vector<long long> w(n);
  for (long long i = 1; i < n; i++) {
    long long p;
    cin >> p;
    p--;
    adj[p].push_back(i);
  }
  for (long long i = 0; i < n; i++) cin >> w[i];
  string ans = "POSSIBLE";
  if (dfs(adj, 0, w) == -1) ans = "IM" + ans;
  cout << ans << endl;
  return 0;
}
