#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int N, P[1010], X[1010];
vector<vector<int> > G(1010);
pair<int, int> dfs(int v) {
  int n = G[v].size();
  if (n == 0) return make_pair(X[v], 0);
  int dp[n + 1][X[v] + 1];
  for (int i = 0; i < (n + 1); i++)
    for (int j = 0; j < (X[v] + 1); j++) dp[i][j] = 0;
  dp[0][0] = 1;
  long long sum = 0;
  int flag = 1;
  for (int i = 0; i < (G[v].size()); i++) {
    pair<int, int> tmp = dfs(G[v][i]);
    sum = sum + tmp.first + tmp.second;
    if (tmp.first == 0 || tmp.second == 0) flag = 0;
    for (int j = 0; j < (X[v] + 1); j++)
      if (dp[i][j] != 0) {
        dp[i + 1][j] = 1;
        if (j + tmp.first <= X[v]) dp[i + 1][j + tmp.first] = 1;
        if (j + tmp.second <= X[v]) dp[i + 1][j + tmp.second] = 1;
      }
  }
  int ok = 5050;
  for (int j = flag; j <= X[v]; j++)
    if (dp[n][j] != 0) ok = j;
  pair<int, int> res;
  if (ok == 5050) {
    cout << "IMPOSSIBLE\n";
    exit(0);
  } else {
    res = make_pair(X[v], sum - ok);
  }
  return res;
}
int main() {
  cin >> N;
  for (int i = 0; i < (N - 1); i++) {
    cin >> P[i];
    P[i]--;
    G[P[i]].push_back(i + 1);
  }
  for (int i = 0; i < (N); i++) cin >> X[i];
  dfs(0);
  cout << "POSSIBLE\n";
  return 0;
}
