#include <bits/stdc++.h>
using namespace std;
long long N;
vector<long long> G[1010];
vector<long long> X(1010);
static long long dp[1010][5050];
pair<long long, long long> rec(long long n, long long pre) {
  vector<pair<long long, long long>> e;
  for (auto x : G[n]) {
    if (x != pre) {
      e.push_back(rec(x, n));
    }
  }
  long long sum = 0;
  memset(dp, 0, sizeof(dp));
  dp[0][0] = true;
  long long i = 0;
  for (auto x : e) {
    for (long long j = 0; j <= X[n]; j++) {
      if (!dp[i][j]) continue;
      long long l = x.first, r = x.second;
      sum += l + r;
      if (j + l <= X[n]) dp[i + 1][j + l] = true;
      if (j + r <= X[n]) dp[i + 1][j + r] = true;
    }
    i++;
  }
  long long M = 1e18;
  for (long long i = X[n]; i >= 0; i--) {
    if (dp[e.size()][i]) {
      M = i;
      break;
    }
  }
  if (M == 1e18) {
    cout << "IMPOSSIBLE" << endl;
    exit(0);
  }
  return make_pair(X[n], sum - M);
}
signed main() {
  cin >> N;
  for (long long i = 0; i < N - 1; i++) {
    long long p;
    cin >> p;
    p--;
    G[i + 1].push_back(p);
    G[p].push_back(i + 1);
  }
  for (long long i = 0; i < N; i++) cin >> X[i];
  rec(0, -1);
  cout << "POSSIBLE" << endl;
  return 0;
}
