#include <bits/stdc++.h>
using namespace std;
int n, tot, f[1010][5010], a[1010], mn[1010], g[5010], e[100010], nt[100010],
    hd[100010];
void build(int x, int y) {
  tot++;
  e[tot] = y;
  nt[tot] = hd[x];
  hd[x] = tot;
}
void dfs(int x, int fa) {
  int i, j;
  for (i = 1; i <= a[x]; i++) f[x][i] = 1e9;
  f[x][0] = 0;
  for (i = hd[x]; i; i = nt[i]) {
    if (e[i] == fa) continue;
    dfs(e[i], x);
    for (j = 0; j <= a[x]; j++) g[j] = 1e9;
    for (j = a[x] - a[e[i]]; j >= 0; j--)
      if (f[x][j] < 1e9)
        g[j + a[e[i]]] = min(g[j + a[e[i]]], f[x][j] + mn[e[i]]);
    for (j = a[x] - mn[e[i]]; j >= 0; j--)
      if (f[x][j] < 1e9)
        g[j + mn[e[i]]] = min(g[j + mn[e[i]]], f[x][j] + a[e[i]]);
    for (j = 0; j <= a[x]; j++) f[x][j] = g[j];
  }
  mn[x] = 1e9;
  for (j = 0; j <= a[x]; j++) mn[x] = min(mn[x], f[x][j]);
}
int main() {
  int i, x;
  scanf("%d", &n);
  for (i = 2; i <= n; i++) {
    scanf("%d", &x);
    build(x, i);
  }
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  dfs(1, 0);
  if (mn[1] > 10000)
    puts("IMPOSSIBLE");
  else
    puts("POSSIBLE");
}
