#include <bits/stdc++.h>
using namespace std;
long long dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
long long dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
long long N;
vector<long long> tree[1100];
long long X[1100];
bool dp[1100][5500];
bool dfs(long long n, long long& a, long long& b) {
  long long sum = 0;
  for (long long i = 0; i <= X[n]; i++) {
    dp[0][i] = false;
  }
  dp[0][0] = true;
  for (long long i = 0; i < tree[n].size(); i++) {
    long long tmp_a, tmp_b;
    if (!dfs(tree[n][i], tmp_a, tmp_b)) {
      return false;
    }
    sum += tmp_a + tmp_b;
    for (long long j = 0; j <= X[n]; j++) {
      dp[i + 1][j] = false;
      if (j - tmp_a >= 0) {
        dp[i + 1][j] |= dp[i][j - tmp_a];
      }
      if (j - tmp_b >= 0) {
        dp[i + 1][j] |= dp[i][j - tmp_b];
      }
    }
  }
  for (long long i = X[n]; i >= 0; i--) {
    if (dp[tree[n].size()][i]) {
      a = X[n];
      b = sum - i;
      return true;
    }
  }
  return false;
}
signed main() {
  cin >> N;
  for (long long i = 1; i < N; i++) {
    long long P;
    cin >> P;
    tree[P - 1].push_back(i);
  }
  for (long long i = 0; i < N; i++) {
    cin >> X[i];
  }
  long long tmp_a, tmp_b;
  if (dfs(0, tmp_a, tmp_b)) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
