#include <bits/stdc++.h>
using namespace std;
int n;
int p[1000], x[1000];
vector<int> children[1000];
pair<int, int> solve(int v) {
  int dp[5001];
  int64_t sum = 0;
  for (int i = 1; i <= 5000; ++i) dp[i] = -1;
  dp[0] = 0;
  for (size_t i = 0; i < children[v].size(); ++i) {
    int u = children[v][i];
    auto p = solve(u);
    sum += p.first + p.second;
    vector<int> idx;
    for (int j = 0; j <= 5000; ++j)
      if (dp[j] == i) idx.push_back(i);
    for (int j : idx) {
      if (j + p.first <= 5000) dp[j + p.first] = i + 1;
      if (j + p.second <= 5000) dp[j + p.second] = i + 1;
    }
  }
  for (int i = x[v]; i >= 0; --i) {
    if (dp[i] == children[v].size()) {
      int ret = sum - i;
      return {min(ret, x[v]), max(ret, x[v])};
    }
  }
  cout << "IMPOSSIBLE\n";
  exit(0);
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout.setf(ios_base::fixed, ios_base::floatfield);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> p[i];
    --p[i];
    children[p[i]].push_back(i);
  }
  for (int i = 0; i < n; ++i) cin >> x[i];
  solve(0);
  cout << "POSSIBLE\n";
  return 0;
}
