#include <bits/stdc++.h>
const int inf = 2e9;
const int N = 5e3 + 10;
const int M = 5e3 + 10;
using namespace std;
int n, x, p[N], w[N], f[N], g1[M], g2[M];
int tov[N], nex[N], las[N], tot;
void ins(int x, int y) { tov[++tot] = y, nex[tot] = las[x], las[x] = tot; }
void Dfs(int k) {
  for (int x = las[k]; x; x = nex[x]) Dfs(tov[x]);
  g1[0] = 0;
  for (int i = 1; i <= w[k]; i++) g1[i] = inf;
  for (x = las[k]; x; x = nex[x]) {
    for (int i = 0; i <= w[k]; i++) g2[i] = inf;
    for (int i = w[k] - w[tov[x]]; i >= 0; i--)
      ((g2[i + w[tov[x]]]) =
           ((g2[i + w[tov[x]]]) < (g1[i] + f[tov[x]]) ? (g2[i + w[tov[x]]])
                                                      : (g1[i] + f[tov[x]])));
    for (int i = w[k] - f[tov[x]]; i >= 0; i--)
      ((g2[i + f[tov[x]]]) =
           ((g2[i + f[tov[x]]]) < (g1[i] + w[tov[x]]) ? (g2[i + f[tov[x]]])
                                                      : (g1[i] + w[tov[x]])));
    for (int i = 0; i <= w[k]; i++) g1[i] = g2[i];
  }
  f[k] = inf;
  for (int i = 0; i <= w[k]; i++)
    ((f[k]) = ((f[k]) < (g1[i]) ? (f[k]) : (g1[i])));
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) scanf("%d", &p[i]), ins(p[i], i);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  Dfs(1);
  puts(f[1] == inf ? "IMPOSSIBLE" : "POSSIBLE");
}
