#include <bits/stdc++.h>
const int INF = 1e9, MOD = 1e9 + 7;
const long long LINF = 1e18;
using namespace std;
bool dp[1000][10002];
signed main() {
  long long N;
  cin >> N;
  std::vector<long long> parent(N, 0), son(N, 0), x(N);
  for (long long i = 1; i < N; i++) cin >> parent[i];
  for (long long i = 0; i < N; i++) parent[i]--;
  for (long long i = 0; i < N; i++) cin >> x[i];
  for (long long i = 0; i < N; i++) son[parent[i]]++;
  queue<long long> que;
  for (long long i = 0; i < N; i++)
    if (son[i] == 0) que.push(i);
  std::vector<pair<long long, long long> > v[N];
  while (que.size()) {
    long long g = que.front();
    que.pop();
    long long si = v[g].size();
    for (long long i = 0; i <= si; i++)
      for (long long j = 0; j <= 5000; j++) dp[i][j] = 0;
    dp[0][0] = 1;
    long long sum = 0;
    for (long long i = 0; i < si; i++) {
      sum += v[g][i].first + v[g][i].second;
      for (long long j = 0; j <= 5000; j++) {
        if (!dp[i][j]) continue;
        dp[i + 1][j + v[g][i].first] = 1;
        dp[i + 1][j + v[g][i].second] = 1;
      }
    }
    long long check = -1;
    for (long long i = 0; i <= 5000; i++) {
      if (!dp[si][i]) continue;
      if (i <= x[g]) check = max(check, i);
      if (sum - i <= x[g]) check = max(check, sum - i);
    }
    if (check == -1) {
      cout << "IMPOSSIBLE" << endl;
      return 0;
    }
    if (parent[g] == -1) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
    v[parent[g]].push_back(pair<long long, long long>(x[g], sum - check));
    if (v[parent[g]].size() == son[parent[g]]) que.push(parent[g]);
  }
}
