#include <bits/stdc++.h>
using namespace std;
int head[1002], ver[1002 * 2], nxt[1002 * 2], l;
int n, i, v[1002], f[5002], g[1002];
int read() {
  char c = getchar();
  int w = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c <= '9' && c >= '0') {
    w = w * 10 + c - '0';
    c = getchar();
  }
  return w;
}
void insert(int x, int y) {
  l++;
  ver[l] = y;
  nxt[l] = head[x];
  head[x] = l;
}
void dp(int x) {
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    dp(y);
    for (int j = v[x]; j > 0; j--) {
      int tmp = 1 << 30;
      if (j >= v[y]) tmp = min(tmp, f[j - v[y]] + g[y]);
      if (j >= g[y]) tmp = min(tmp, f[j - g[y]] + v[y]);
      f[j] = tmp;
    }
  }
  g[x] = 1 << 30;
  for (int i = 1; i <= v[x]; i++) g[x] = min(g[x], f[i]);
}
int main() {
  n = read();
  for (i = 2; i <= n; i++) {
    int fa = read();
    insert(fa, i);
  }
  for (i = 1; i <= n; i++) v[i] = read();
  dp(1);
  if (g[1] != 1 << 30)
    puts("POSSIBLE");
  else
    puts("IMPOSSIBLE");
  return 0;
}
