#include <bits/stdc++.h>
using namespace std;
int read() {
  char s;
  int k = 0, base = 1;
  while ((s = getchar()) != '-' && s != EOF && !(s >= '0' && s <= '9'))
    ;
  if (s == EOF) exit(0);
  if (s == '-') base = -1, s = getchar();
  while (s >= '0' && s <= '9') {
    k = k * 10 + (s - '0');
    s = getchar();
  }
  return k * base;
}
void write(int x) {
  if (x < 0) {
    putchar('-');
    write(-x);
  } else {
    if (x / 10) write(x / 10);
    putchar(x % 10 + '0');
  }
}
const int maxn = 1e3 + 100;
int n, X;
int to[maxn << 1], ne[maxn << 1], po[maxn], id;
int dp[2][6000], d[maxn];
int a[maxn], b[maxn];
inline void add(int x, int y) {
  id++;
  to[id] = y;
  ne[id] = po[x];
  po[x] = id;
}
bool dfs(int x, int fa) {
  int y;
  if (d[x] == 1 && x != 1) return true;
  for (int i = po[x]; i; i = ne[i]) {
    y = to[i];
    if (y == fa) continue;
    if (!dfs(to[i], x)) return false;
  }
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  int cur = 0, sum = 0;
  for (int i = po[x]; i; i = ne[i]) {
    cur ^= 1;
    y = to[i];
    if (y == fa) continue;
    sum += a[y] + b[y];
    for (int j = a[x]; j >= a[y]; j--) {
      dp[cur][j] |= dp[cur ^ 1][j - a[y]];
    }
    for (int j = a[x]; j >= b[y]; j--) {
      dp[cur][j] |= dp[cur ^ 1][j - b[y]];
    }
  }
  for (int j = a[x]; j >= 0; j--) {
    if (dp[cur][j]) {
      b[x] = sum - j;
      return true;
    }
  }
  return false;
}
int main() {
  n = read();
  for (int i = 2; i <= n; i++) {
    X = read();
    add(X, i);
    add(i, X);
    d[i]++;
    d[X]++;
  }
  if (n == 1) {
    printf("POSSIBLE\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) a[i] = read();
  if (dfs(1, 0))
    printf("POSSIBLE");
  else
    printf("IMPOSSIBLE");
  return 0;
}
