#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 11;
const int M = 5e3 + 11;
int dp[N], n, fa[N], x[N], f[M];
int head[N], to[N], nex[N], size;
void add(int x, int y) {
  to[++size] = y;
  nex[size] = head[x];
  head[x] = size;
}
void dfs(int u) {
  memset(f, 127 / 9, sizeof(f));
  f[0] = 0;
  for (int i = head[u]; i; i = nex[i]) {
    int v = to[i];
    dfs(v);
    for (int j = x[u]; j >= 0; j--) {
      if (f[j] == f[x[u] + 1]) continue;
      int tmp = f[j];
      f[j] = dp[0];
      if (j + x[v] <= x[u]) {
        f[j + x[v]] = min(f[j + x[v]], tmp + dp[v]);
      }
      if (j + dp[v] <= x[u]) {
        f[j + dp[v]] = min(f[j + dp[v]], tmp + x[v]);
      }
    }
  }
  for (int i = 0; i <= x[u]; i++) {
    dp[u] = min(dp[u], f[i]);
  }
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> fa[i];
    add(fa[i], i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> x[i];
  }
  memset(dp, 127 / 9, sizeof(dp));
  dfs(1);
  if (dp[1] == dp[0])
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
  return 0;
}
