#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)1e3;
const int INF = (int)1e9;
std::vector<int> g[MAXN + 1];
int val[MAXN + 1];
int dp[MAXN + 1];
int dp1[5 * MAXN + 1];
bool dp2[5 * MAXN + 1];
void dfs(int nod, int p) {
  int i, j;
  if (g[nod].size() == 0) {
    dp[nod] = 0;
    return;
  }
  for (auto it : g[nod])
    if (it != p) dfs(it, nod);
  for (i = 1; i <= val[nod]; i++) dp1[i] = INF;
  dp1[0] = 0;
  for (auto it : g[nod]) {
    memset(dp2, 0, sizeof(dp2));
    for (j = val[nod]; j >= 0; j--) {
      if (j - val[it] >= 0) {
        dp1[j] = std::min(dp1[j], dp1[j - val[it]] + dp[it]);
        dp2[j] = 1;
      }
      if (j - dp[it] >= 0) {
        dp1[j] = std::min(dp1[j], dp1[j - dp[it]] + val[it]);
        dp2[j] = 1;
      }
    }
    for (j = val[nod]; j >= 0; j--) {
      if (dp2[j] == 0) dp1[j] = INF;
      dp2[j] = 0;
    }
  }
  dp[nod] = INF;
  for (i = 0; i <= val[nod]; i++) dp[nod] = min(dp[nod], dp1[i]);
  if (dp[nod] == INF) {
    cout << "IMPOSSIBLE";
    exit(0);
  }
}
int main() {
  int n, i, x;
  ios::sync_with_stdio(false);
  cin >> n;
  for (i = 2; i <= n; i++) {
    cin >> x;
    g[x].push_back(i);
  }
  for (i = 1; i <= n; i++) cin >> val[i];
  dfs(1, 0);
  cout << "POSSIBLE";
  return 0;
}
