#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, t = 0, b[N << 1], w[N], f[N][2] = {}, g[N], v[N << 1];
struct tq {
  int y;
  int nxt;
} a[N << 1];
inline void in(int x, int y) {
  a[++t].nxt = b[x];
  b[x] = t;
  a[t].y = y;
  return;
}
inline int read() {
  int sum = 0, flag = 1;
  char c;
  for (; c < '0' || c > '9'; c = getchar()) {
    if (c == '-') {
      flag = -1;
    }
  }
  for (; c >= '0' && c <= '9'; c = getchar()) {
    sum = (sum << 3) + (sum << 1) + c - '0';
  }
  return sum * flag;
}
inline void dfs(int x, int fa) {
  int mx = 0, mn = 0, cnt = 0;
  for (int i = b[x]; i; i = a[i].nxt) {
    int y = a[i].y;
    if (y == fa) {
      continue;
    }
    dfs(y, x);
    mx += f[y][0];
    mn += f[y][1];
    g[++cnt] = f[y][0] - f[y][1];
  }
  if (mn > w[x]) {
    puts("IMPOSSIBLE");
    exit(0);
  }
  if (mx <= w[x]) {
    f[x][0] = w[x];
    f[x][1] = mn;
    return;
  }
  memset(v, 0, sizeof(v));
  int m = w[x] - mn;
  v[0] = 1;
  for (int i = 1; i <= cnt; ++i) {
    for (int j = m; j >= g[i]; --j) {
      v[j] += v[j - g[i]];
    }
  }
  f[x][0] = mx;
  f[x][1] = w[x];
  for (int i = m; i; --i) {
    if (v[i]) {
      f[x][0] = mx - i;
      break;
    }
  }
  if (f[x][0] < f[x][1]) {
    swap(f[x][0], f[x][1]);
  }
  return;
}
int main() {
  n = read();
  for (int i = 2; i <= n; ++i) {
    int x = read();
    in(x, i);
    in(i, x);
  }
  for (int i = 1; i <= n; ++i) {
    w[i] = read();
  }
  dfs(1, 0);
  puts("POSSIBLE");
  return 0;
}
