#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int M = 5005;
struct E {
  int to, next;
} mem[N << 1];
int n, num, x, inf;
bool tag;
int head[N], d[N], a[N], f[2][N], dp[N];
void add(int x, int y) {
  num++;
  mem[num].to = y;
  mem[num].next = head[x];
  head[x] = num;
  d[x]++;
}
void dfs(int k) {
  int w, b, j, u, now, last, i, mn = inf;
  for (j = head[k]; j; j = mem[j].next) {
    u = mem[j].to;
    dfs(u);
  }
  now = 0;
  last = 1;
  memset(f, 0x3f, sizeof(f));
  f[0][0] = 0;
  for (j = head[k]; j; j = mem[j].next) {
    u = mem[j].to;
    now ^= 1;
    last ^= 1;
    w = dp[u];
    b = a[u];
    for (i = 0; i <= a[k]; i++) {
      if (i + w <= a[k]) f[now][i + w] = min(f[now][i + w], f[last][i] + b);
      if (i + b <= a[k]) f[now][i + b] = min(f[now][i + b], f[last][i] + w);
    }
  }
  for (i = 0; i <= a[k]; i++) mn = min(mn, f[now][i]);
  if (mn == inf) tag = 0;
  dp[k] = mn;
}
int main() {
  int i;
  scanf("%d", &n);
  tag = 1;
  for (i = 2; i <= n; i++) {
    scanf("%d", &x);
    add(x, i);
  }
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(f, 0x3f, sizeof(f));
  inf = f[0][0];
  dfs(1);
  if (tag)
    printf("POSSIBLE\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
