#include <bits/stdc++.h>
using namespace std;
const int INF = 10000;
const int MAXN = 1000;
const int MAXW = 5000;
vector<int> g[MAXN + 1];
int w[MAXN + 1];
int dp[MAXN + 1];
int aux[MAXW + 1][2];
void dfs(int nod) {
  for (auto it : g[nod]) {
    dfs(it);
  }
  if (g[nod].empty()) {
    return;
  }
  int j;
  dp[nod] = INF;
  int cur = 1;
  aux[0][0] = 0;
  for (j = 1; j <= MAXW; j++) {
    aux[j][0] = INF;
  }
  for (auto it : g[nod]) {
    for (j = MAXW; j >= 0; j--) {
      aux[j][cur] = INF;
      if (j >= w[it])
        aux[j][cur] = min(aux[j][cur], aux[j - w[it]][1 - cur] + dp[it]);
      if (j >= dp[it])
        aux[j][cur] = min(aux[j][cur], aux[j - dp[it]][1 - cur] + w[it]);
    }
    cur = 1 - cur;
  }
  for (j = 0; j <= w[nod]; j++) {
    dp[nod] = min(dp[nod], aux[j][1 - cur]);
  }
}
int main() {
  int i, n;
  ios::sync_with_stdio(false);
  cin >> n;
  for (i = 2; i <= n; i++) {
    int p;
    cin >> p;
    g[p].push_back(i);
  }
  for (i = 1; i <= n; i++) {
    cin >> w[i];
  }
  dfs(1);
  if (dp[1] < INF) {
    cout << "POSSIBLE";
  } else {
    cout << "IMPOSSIBLE";
  }
  return 0;
}
